当前位置:网站首页>【小技巧】使用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中,然后做读取就可以了。
边栏推荐
- MySQL connection query and subquery
- Global and Chinese market of X-ray detectors 2022-2028: Research Report on technology, participants, trends, market size and share
- Knowing things by learning | self supervised learning helps improve the effect of content risk control
- 蓝桥杯单片机第四届省赛
- Download and use of the super perfect screenshot tool snipaste
- C#聯合halcon脫離halcon環境以及各種報錯解决經曆
- Imageai installation
- PHP array processing
- C # joint halcon out of halcon Environment and various Error Reporting and Resolution Experiences
- The 9th Blue Bridge Cup single chip microcomputer provincial competition
猜你喜欢

《MATLAB 神经网络43个案例分析》:第42章 并行运算与神经网络——基于CPU/GPU的并行神经网络运算

Screenshot literacy tool download and use

NLog use

一天上手Aurora 8B/10B IP核(5)----从Framing接口的官方例程学起

The 5th Blue Bridge Cup single chip microcomputer provincial competition

蓝桥杯单片机省赛第十届

【直播回顾】战码先锋首期8节直播完美落幕,下期敬请期待!

"Analysis of 43 cases of MATLAB neural network": Chapter 42 parallel operation and neural network - parallel neural network operation based on cpu/gpu

Haute performance et faible puissance Cortex - A53 Core Board | i.mx8m mini

0基础如何学习自动化测试?按照这7步一步一步来学习就成功了
随机推荐
Oracle 常用SQL
MD5 of Oracle
Comment élaborer une stratégie nuageuse à l'ère des nuages mixtes
Exchange rate query interface
[designmode] Prototype Pattern
高性能 低功耗Cortex-A53核心板 | i.MX8M Mini
一天上手Aurora 8B/10B IP核(5)----从Framing接口的官方例程学起
蓝桥杯单片机省赛第十一届第二场
Review materials of project management PMP high frequency examination sites (8-1)
"Analysis of 43 cases of MATLAB neural network": Chapter 42 parallel operation and neural network - parallel neural network operation based on cpu/gpu
Getting started with MQ
接口调试工具模拟Post上传文件——ApiPost
Unity脚本的基础语法(8)-协同程序与销毁方法
In the era of programmers' introspection, five-year-old programmers are afraid to go out for interviews
[yolo3d]: real time detection of end-to-end 3D point cloud input
Global and Chinese market of autotransfusion bags 2022-2028: Research Report on technology, participants, trends, market size and share
How about Ping An lifetime cancer insurance?
PY3 link MySQL
Download and use of the super perfect screenshot tool snipaste
Halcon image rectification