当前位置:网站首页>【小技巧】使用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中,然后做读取就可以了。
边栏推荐
- 蓝桥杯单片机省赛第九届
- 蓝桥杯单片机省赛第五届
- The 6th Blue Bridge Cup single chip microcomputer provincial competition
- Unity脚本的基础语法(6)-特定文件夹
- Network connection mode of QT
- Gradle foundation | customize the plug-in and upload it to jitpack
- Get started with Aurora 8b/10b IP core in one day (5) -- learn from the official routine of framing interface
- 蓝桥杯单片机数码管技巧
- How to do medium and long-term stocks, and what are the medium and long-term stock trading skills?
- High performance and low power cortex-a53 core board | i.mx8m Mini
猜你喜欢

Large screen visualization from bronze to the advanced king, you only need a "component reuse"!

MySQL index, transaction and storage engine

The fourth provincial competition of Bluebridge cup single chip microcomputer

蓝桥杯单片机省赛第十一届第二场

Interface debugging tool simulates post upload file - apipost

JIT deep analysis
![[golang] leetcode intermediate bracket generation & Full Permutation](/img/93/ca38d97c721ccba2505052ef917788.jpg)
[golang] leetcode intermediate bracket generation & Full Permutation

This article describes the step-by-step process of starting the NFT platform project

傅里叶级数

Knowing things by learning | self supervised learning helps improve the effect of content risk control
随机推荐
一天上手Aurora 8B/10B IP核(5)----从Framing接口的官方例程学起
SAML2.0 notes (I)
蓝桥杯单片机省赛第十二届第二场
The 9th Blue Bridge Cup single chip microcomputer provincial competition
Uniapp uses canvas to generate posters and save them locally
aaaaaaaaaaaaa
PY3 link MySQL
MySQL index, transaction and storage engine
Basic syntax of unity script (6) - specific folder
Account management of MySQL
Kotlin基础学习 17
蓝桥杯单片机数码管技巧
蓝桥杯单片机省赛第六届
"Analysis of 43 cases of MATLAB neural network": Chapter 42 parallel operation and neural network - parallel neural network operation based on cpu/gpu
Which of PMP and software has the highest gold content?
Comment élaborer une stratégie nuageuse à l'ère des nuages mixtes
Kotlin basic learning 17
Gradle foundation | customize the plug-in and upload it to jitpack
0 foundation how to learn automated testing? Follow these seven steps step by step and you will succeed
[C Advanced] brother Peng takes you to play with strings and memory functions