フィルターのクリア

load a txt file to load a columns in a tex box on GUI

1 回表示 (過去 30 日間)
Biza Ferreira
Biza Ferreira 2014 年 8 月 31 日
編集済み: Biza Ferreira 2014 年 9 月 1 日
I have made a interface on GUI Matlab, now a have a button to open a .txt file. I need load into a text box, some data how coming from txt file. But my problem is that data are disposed in columns like this.
Vol AA MM DD hh mm ss
Vol AA MM DD hh mm ss
Vol AA MM DD hh mm ss
Vol AA MM DD hh mm ss
I have done this code: if true % code [filename pathname] = uigetfile({'*.txt'},'Open File'); fullpathname =strcat(pathname, filename); text= fileread(fullpathname); set(handles.pathy,'String',fullpathname); end
  1 件のコメント
Jos
Jos 2014 年 8 月 31 日
Hi,
I'm not entirely sure what you want to do, could you show what the text file looks like and what exactly you want to display in the text box

サインインしてコメントする。

採用された回答

Jos
Jos 2014 年 8 月 31 日
[filename, pathname] = uigetfile({'*.txt'},'Open File');
fullpathname = strcat(pathname, filename);
fileVars = dlmread(fullpathname,'',0,0);
displayVar = fileVars(1,3);
set(handles.pathy,'String',num2str(displayVar));
fill in the row and column you want on line 4

その他の回答 (3 件)

Biza Ferreira
Biza Ferreira 2014 年 8 月 31 日
編集済み: Biza Ferreira 2014 年 8 月 31 日
ok
  1 件のコメント
Jos
Jos 2014 年 8 月 31 日
what do you want to display in the text box? Currently you're printing the path and file name, do you want to show all data lines in your file in the text box? If so, you want to replace set(handles.pathy,'String',fullpathname) with set(handles.pathy,'String',text)

サインインしてコメントする。


Biza Ferreira
Biza Ferreira 2014 年 8 月 31 日
For exemple just de first line and third column

Biza Ferreira
Biza Ferreira 2014 年 8 月 31 日
編集済み: Biza Ferreira 2014 年 9 月 1 日
Thank You Jos for your answer. I am developing an ECG, which stores the data on SDcard, at this time trying to make a friendly interface. Vol means voltage AA means year MM means month ... .. when I load the file I want to display data from the first acquisition and the acquisition purchase made. The microcontroller records the data the way I showed you above. And Iam trying to put voltage and time in a dynamic graphic, to see all time line extension, and show start date acquisition like this

カテゴリ

Help Center および File ExchangeString Parsing についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by