当前位置:网站首页>【小技巧】使用matlab GUI以对话框模式读取文件
【小技巧】使用matlab GUI以对话框模式读取文件
2022-07-02 03:38:00 【fpga和matlab】
在MATLAB 界面设计过程中,经常需要通过按键来调用读取文件的对话框,具体可以通过如下的代码来实现:
[filename,pathname]=uigetfile({'*.jpg','样本文件(*.jpg)';'*,*','所有文件(*.*)'},'请选择一个样本文件');
if isequal(filename,0)||isequal(pathname,0)
return;
end
FileName_AVI = [pathname,filename];
此时,运行GUI界面,可以弹出如下的对话框:
可以看到,对话框中提示jpg格式的文件,如果改为其他的,也可以做相似的文件,如txt文件,如下所示:
[filename,pathname]=uigetfile({'*.txt','样本文件(*.txt)';'*,*','所有文件(*.*)'},'请选择一个样本文件');
if isequal(filename,0)||isequal(pathname,0)
return;
end
FileName_AVI = [pathname,filename];
此时,运行GUI界面,可以弹出如下的对话框:
运行之后,文件的路径将保存到变量FileName_AVI中,然后做读取就可以了。
边栏推荐
- C # joint halcon out of halcon Environment and various Error Reporting and Resolution Experiences
- 蓝桥杯单片机省赛第五届
- FFMpeg AVFrame 的概念.
- Work hard all day long and be alert at sunset
- [punch in] flip the string (simple)
- Kotlin basic learning 17
- 高性能 低功耗Cortex-A53核心板 | i.MX8M Mini
- 傅里叶级数
- Kotlin基础学习 16
- MySQL connection query and subquery
猜你喜欢
Uniapp uses canvas to generate posters and save them locally
MD5 of Oracle
Failed to upgrade schema, error: “file does not exist
Halcon image rectification
[C Advanced] brother Peng takes you to play with strings and memory functions
蓝桥杯单片机第六届温度记录器
Didi open source Delta: AI developers can easily train natural language models
Which of PMP and software has the highest gold content?
Download and use of the super perfect screenshot tool snipaste
Account management of MySQL
随机推荐
The 9th Blue Bridge Cup single chip microcomputer provincial competition
蓝桥杯单片机省赛第九届
0基础如何学习自动化测试?按照这7步一步一步来学习就成功了
In depth interpretation of pytest official documents (26) customized pytest assertion error information
High performance and low power cortex-a53 core board | i.mx8m Mini
NLog使用
Global and Chinese market of handheld ultrasonic scanners 2022-2028: Research Report on technology, participants, trends, market size and share
Aaaaaaaaaaaa
Global and Chinese market of gynaecological health training manikin 2022-2028: Research Report on technology, participants, trends, market size and share
Which of PMP and software has the highest gold content?
傅里叶级数
Global and Chinese markets for electronic laryngoscope systems 2022-2028: Research Report on technology, participants, trends, market size and share
Kotlin basic learning 17
Oracle viewing locked tables and unlocking
Unity脚本的基础语法(8)-协同程序与销毁方法
蓝桥杯单片机省赛第十一届第一场
《MATLAB 神经网络43个案例分析》:第41章 定制神经网络的实现——神经网络的个性化建模与仿真
In depth analysis of C language - variable error prone knowledge points # dry goods inventory #
VS2010插件NuGet
蓝桥杯单片机省赛第六届