How to assign character/string in the for loop

7 views (last 30 days)
Turbulence Analysis
Turbulence Analysis on 12 Feb 2022
Edited: Stephen23 on 12 Feb 2022
Hi,
I am defining the character fname = '*A'
I need to use this chracter insdie the for loop as follows, fname(i)={load(flist(i).name)};
Basically, while exceuting, this needs to run as A(i)={load(flist(i).name)};
fname = '*A'
filename = strcat(fname_strt,'mean*');
flist=dir (filename);
for i=1:1
name{i}=flist(i).name;
fname(i)={load(flist(i).name)};
end
  2 Comments

Sign in to comment.

Accepted Answer

Catalytic
Catalytic on 12 Feb 2022
name={flist.name};
n=numel(name);
S.(fname)=cell(n,1);
for i=1:1
S.(fname){i}=load(flist(i).name;
end

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by