フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How can I show a .txt composed with data on a edit in GUI?

1 回表示 (過去 30 日間)
bayran arrieta
bayran arrieta 2017 年 6 月 30 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
How can I show a .txt composed with data on a edit in GUI?
the .txt is composed with a matriz of 8*5 with letter and numbers, but the edit on the guide show it but only in one column
file = uigetfile('*.txt')
fid=fopen(file);
qwe2=textscan(fid, '%s %s %s %s %s','Emptyvalue',0,'TreatAsEmpty',{'NA'});
gg=qwe2{1};
zzz=qwe2{3};
xxx=qwe2{2};
Iddd=qwe2{5};
kddd=qwe2{4};
aaa=[gg xxx zzz Iddd kddd]'
set(handles.edit1,'Max', 2, 'string',aaa);
for example: X4.5
Z2.5
K3.5
I4.5
G1
X10
Z2.5 etc...
  1 件のコメント
Geoff Hayes
Geoff Hayes 2017 年 7 月 4 日
baryon - what can you tell us about aaa. Is this a char array or a cell array? If the former, then I suspect that when you concatenate (or transpose) the strings as
aaa=[gg xxx zzz Iddd kddd]'
then you are creating a character array with no whitespace between each column.

回答 (2 件)

Jan
Jan 2017 年 7 月 4 日
編集済み: Jan 2017 年 7 月 4 日
What about:
Str = fileread(file);
CStr = strsplit(Str, '\n');
set(handles.edit1, 'Max', 2, 'string', CStr);
This does not parse the contents of the file, but simply copies it.

Mawwan
Mawwan 2018 年 8 月 26 日
編集済み: Mawwan 2018 年 8 月 26 日

この質問は閉じられています。

製品

Community Treasure Hunt

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

Start Hunting!

Translated by