Reading a string datafile line by line
11 ビュー (過去 30 日間)
古いコメントを表示
Hi all, I've been trying to read strings from a txt file (a replay script from ICEM actually) line by line but I've been unable to so far.
I want to obtain a string array that each element includes one of the lines of the datafile.
the text file looks like this:
_'ic_boco_solver
ic_boco_clear_icons
ic_csystem_display all 0
ic_csystem_set_current global
ic_boco_nastran_csystem reset
ic_undo_group_end
ic_set_global geo_cad 0 toptol_userset
ic_set_global geo_cad 0.0005 toler
ic_undo_group_begin
ic_geo_new_family GEOM
ic_boco_set_part_color GEOM
ic_point {} GEOM pnt.00 -10,10,0'_
I have only managed to either get each all the text in the same element:
_ic_boco_solveric_boco_clear_iconsic_csystem_display_
or each character separately like this:
_I
c
_
b
o
c
o
_
s
o_
or to get chunks that are separated by empty spaces like this:
_'ic_boco_solver'
'ic_boco_clear_icons'
'ic_csystem_display'
'all'
'0'
'ic_csystem_set_current'
'global'
'ic_boco_nastran_csystem'_
, but I could not get the whole line and only the line.
that was using respectively:
temp1=textscan(fid,'%c')
or
temp2=dataread('file','text.txt','%c')
or
temp2=dataread('file','text.txt','%s')
Every line starts with 'ic_'. Maybe that could help?
Thank you!
0 件のコメント
採用された回答
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で String Parsing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!