I have the following script:
a=[1,2,3]
for i=1:length(a)
e=0;
e1=0;
e2=0;
.....
end
In the script the main loop ( the first ) is for i=1:length(a)
. e
,e1
,e2
should being rewritten for each a(i)
as:
% I count the error
a=1: e=0;
e1=0;
e2=0;
a=2: e=0;
e1=0;
e2=0;
a=3: e=0;
e1=0;
e2=0;
Accorsing to my first script, Matlab rewrites e
,e1
,e2, but I need
e,
e1,e2
for each a(i)
.
Question: Is it possible to change name of variables for each a(i)
?
% to change like this?
a=1: e_a_1=0;
e1_a_1=0;
e2_a_1=0;
a=2: e_a_2=0;
e1_a_2=0;
e2_a_2=0;
a=3: e_a_2=0;
e1_a_2=0;
e2_a_2=0;