Reputation: 1
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?
Upvotes: 0
Views: 302
Reputation: 734
If your Picoscope files are all the same length, say Lpico, then this ought to work:
Pico=NaN*ones(32,Lpico);
for k=1:32
filename=strcat("21 pcb 11_",sprintf("%02d",i),".mat")
load(filename)
Lthisrun=length(A);
Pico(k,1:Lthisrun)=A;
endfor
If they have different length, then make Lpico as long as the longest A. Shorter scope ouputs will be padded with NaN's
Upvotes: 1