i=01; j=01; ['F',num2str(i), '_', num2str(j),'.mat']
and not to
The reason for this is that
i=01 is a double type assignment and
i equals to
1 – there are no leading zeros for these types of variables.
a possible solution for the problem would be
for ii = 1:11 for jj= 1:11 filename = sprintf('F_%02d_%02d.mat', ii, jj ); load(filename); Func(Fi_j); % run the function for each file Fi_j end end
Note the use of
sprintfto format the double
jjwith leading zero using
You can use the second argument of
num2strto format its output, e.g.:
It is a good practice to use string formatting tools when dealing with strings.
It is a better practice in matlab not to use
jas loop counters, since their default value in matlab is