Hello, I need to print a names of mesures in plot and i need an array than have a names of all measures:
name_save =
name1
name2
name3
.....
nameN
I get a new names everry loop:
for k = 1:length(l)
.....
[filepath,name,ext] = fileparts(l(k).name);
........
end
How can I save the names in a loop?
name_save(k) = name; %not working
Thank you!

 採用された回答

madhan ravi
madhan ravi 2020 年 6 月 22 日

1 投票

name_save = compose('name%d', 1:numel(l)) ; % before loop
name_save{k} ... inside loop

4 件のコメント

madhan ravi
madhan ravi 2020 年 6 月 22 日
name_save = cell(numel(l), 1); % before loop
name_save{k} = name; % inside loop
Nik Rocky
Nik Rocky 2020 年 6 月 22 日
Perfekt, thanks!
And how can I save just a part of name:
from
003_m1_30_90_ramp_20200611_200632
just
003
?
part_name = strsplit(name_save,'_'); %is not valid for for cells
madhan ravi
madhan ravi 2020 年 6 月 22 日
part_name = regexp(name_save{k},'\d*(?=\_)','match','once')
Nik Rocky
Nik Rocky 2020 年 6 月 22 日
Thank you friend!

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

その他の回答 (0 件)

カテゴリ

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

タグ

質問済み:

2020 年 6 月 22 日

コメント済み:

2020 年 6 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by