How to plot and save the content of a 5D array?
8 views (last 30 days)
I have a 5 dimension array M_ii (attached). It's size is 25x50x3x14x2. I want to plot and save the following on the same figure
And do the same thing for the rest M_ii(:,:,:,pp,ii).
for ii = 1:length(tol)
for pp = 1:length(p)
for bb = 1:length(bgt)
for kk = 1:length(trigger)
I want to save all the resulting figures as .fig files but without displaying them when I run the code above. For the names of the figures, I want something like this: traj151. Where the first one represents bb=1 and number 5 represents pp=5 and the seconed one represents ii=1
Your help and ideas would be appreciated.
Steven Lord on 4 Aug 2022
Is your main question how to assemble the file name? I'd use a string array.
n = 1;
p = 42;
q = 999;
filename = "part" + n + "of" + p + "ForUserID" + q + ".txt"
Or if you need specific formatting, then I'd use sprintf. Note the extra 0 in the display of n in filename2.
filename2 = sprintf("part%02dof%dForUserID%d.txt", n, p, q)