about reading strings with strread using a name of variable the string is allocated to

A = c(1,1)
[starting_number] = strread(???,'capture_%03d.fit')
where output for A is A =
'capture_667.fit'
How can I pass A into the strread??? Is that even possible?
p.s. The strread works if I type in the 'capture_667' inside it

 採用された回答

Orion
Orion 2014 年 10 月 15 日
it seems that A is a cell and not a string.
for a string :
A= 'capture_667.fit'
[starting_number] = strread(A,'capture_%3d.fit')
for a cell
A= {'capture_667.fit'}
[starting_number] = strread(char(A),'capture_%3d.fit')

その他の回答 (1 件)

Thorsten
Thorsten 2014 年 10 月 15 日
Get rid of the extension '.fit'
[pathstr name ext] = fileparts(A);
starting_number = strread(name, 'capture_%03d');

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

タグ

質問済み:

2014 年 10 月 15 日

回答済み:

2014 年 10 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by