Matlab使用GUI按钮调用“导入数据" [英] Matlab Calling 'Import Data' with GUI Button

查看:1095
本文介绍了Matlab使用GUI按钮调用“导入数据"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Matlab R2014b的GUI中工作,该GUI使用txt文件中的某些数据,因此我想调用导入数据"窗口,以允许用户在按下按钮时从文件中选择数据.有办法吗?

I'm working in a GUI in Matlab R2014b that uses some data from a txt file, so i want to call the 'Import Data' window to permit the user select the data from a file when pushing a button. Is there a way to do this?

推荐答案

函数 uiimport 用于以交互方式导入数据. 似乎是被称为通过Matlab工具栏的导入数据"按钮.

The function uiimport is used for importing data interactively. This seems to be what gets called by Matlab's toolbar's "import data" button.

摘录自摘录,

uiimport打开一个对话框,以交互方式从文件或剪贴板中加载数据. MATLAB®显示文件中数据的预览.

uiimport opens a dialog to interactively load data from a file or the clipboard. MATLAB® displays a preview of the data in the file.

uiimport('-file')首先显示文件选择对话框.

uiimport('-file') presents the file selection dialog first.

S = uiimport(___)将结果变量存储为结构S中的字段.

S = uiimport(___) stores the resulting variables as fields in the struct S.

所以,只需设置

uiimport('-file');

作为按钮的回调.

这篇关于Matlab使用GUI按钮调用“导入数据"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆