I have a code in which I create a large number of the same variable and I would like to store all of its values. Normally I would use for loops for this and store all of them, but due to some complications it is not possible at the moment.
I have to calculate the variable x, store it as x1. Calcute the x with different conditions and store it as x2 etc. The problem I have that I would have to manually change all the x's in my code to x2, x3, x4 etc. And there are a lot of them. Is there a way to it more efficiently?
To better illustrate:
x1 = 5*y(1);
%some calculations with y
x2 = 5*y(2);
% some claculations with y
x3=5*y(3);
5or is it? My pointer for you is still hovering around at suggesting vectorized methods.x(1) = 5*y(1)so on and so forth?x(1)andx(2)are the right way to go.