フィルターのクリア

Insert whole containing of text file to Matlab

2 ビュー (過去 30 日間)
Jack
Jack 2014 年 7 月 16 日
編集済み: per isakson 2015 年 1 月 11 日
Hi. I have a text file (.txt) that I want insert all containing of it to Matlab and show it in a text box. Sometimes this text box updates when I GUI open it so there isn’t a specified text in it. (It is like a help note for my GUI that has text, numbers etc.) . I want insert whole containing of this text file automatically to my text box in Matlab. What should I do?
Thanks.
  2 件のコメント
Jasmine
Jasmine 2014 年 7 月 16 日
Could you please share any code you have already written?
Jack
Jack 2014 年 7 月 16 日
編集済み: per isakson 2015 年 1 月 10 日
I'm using textscan like this :
dd_reader = fopen([pwd 'Text file address']);
NSV_NN = textscan(Add_reader,'%str');
NSV_NN=NSV_NN{1};
NSV_NN=NSV_NN{1};

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

回答 (1 件)

per isakson
per isakson 2015 年 1 月 11 日
編集済み: per isakson 2015 年 1 月 11 日
Example of setting and resetting the string of an editbox
figure
str = fileread('cssm_1.help');
ebh = uicontrol ...
( 'Style' , 'Edit' ...
, 'Units' , 'Normalized' ...
, 'Position' , [0.1,0.1,0.8,.8] ...
, 'Max' , 2 ...
, 'Horizontal', 'left' ...
, 'String' , str );
fid = fopen('cssm_2.help');
cac = textscan( fid, '%s', 'Delimiter', '\n' );
[~] = fclose( fid );
set( ebh, 'String', cac{1} );
where cssm_1.help and cssm_2.help contains
cssm_help
l1
l2
l3 - is a longer line
and
cssm_help - version 2
l1
l2
l3 - this is a longer line
respectively.

カテゴリ

Help Center および File ExchangeText Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by