當前位置:編程學習大全網 - 電腦編程 - Matlab GUI界面編程,如何導入壹個txt文件

Matlab GUI界面編程,如何導入壹個txt文件

1、在GUI上建立壹個按鈕Button

2、為按鈕Button添加單擊事件,用來導入txt文件

3、在單擊事件中設置要打開的文件地址,以及讀取操作設置

4、具體代碼如下

function?filename=OnFileOpen()

%UNTITLED1?Summary?of?this?function?goes?here

%?Detailed?explanation?goes?here

[filename,filepath]=uigetfile('*.txt','打開文件');%gui中打開文件

%file=[filename,filepath];

%fid=fopen(file,'rt');%read?txt

filep=strcat(filepath,filename);

%filep

workImg=imread(filep);

%提取文件內容

imshow(workImg);

  • 上一篇:想通過hart協議從現場儀表讀取數據,硬件上需要什麽配置,軟件上需要做什麽工作
  • 下一篇:求高手告訴我學習電腦編程的步驟 我想自學
  • copyright 2024編程學習大全網