I need to load and do some maths with 32 files (extension .mat) at the same time. So, after running the code, I expect to have 32 results of the maths.
The problem is that all the codes I'm trying just load the first or the last file.
The name of my files are: 21 pcb 11_01.mat; 21 pcb 11_02 ....21 pcb 11_32. I've tried this:
for i=1:32
filename=strcat("21 pcb 11_",sprintf("%02d",i),".mat")
load(filename)
endfor
As a result, the code only shows the last file in the workspace. I expected the code to load the 32 files.
Can you help me?
*.mat
files have the same name, they will get overwritten with eachload
operation. If that's the case, you want to store the data in a uniquely named variable at each iteration ofload
. Without more information on what's in the*.mat
files, it's difficult to say anymore. – am304