Hi: I have posted before asking one question and I didn't really explain myself correctly so not ALL my question was solved: I have a function which saves some variables each time with a different name in the form of a matrix (30×30). This variables are called Z_1,Z_2,Z_3,etc…
save(['Z_' num2str(v)],'z')
Now I want to add these variables which I have created (Z_1,Z_2,etc) so that it gives me a matrix (30×30) called TotalZ for example. This would be done easily enough using:
load('C\wherever.the.variable.is.stored\Z_1');load('C\wherever.the.variable.is.stored\Z_2');load('C\wherever.the.variable.is.stored\Z_3');TotalZ=Z_1+Z_2+Z_3;
But every time I try running this I get the error;
??? Undefined function or variable 'Z_1'.Error in ==> mapa at 31 TotZ=Z_1+Z_2+Z_3
I am getting a bit frustated as I have clearly defined my variables and loaded them properly (or so I think) so I see no reason for this error. The idea would then be to plot the TotalZ against two variables with a pcolor plot.
Thanks for any help. Guillermo
Best Answer