How do I create an array in struct to keep track of all my_exp?
My code
my_exp=struct(x, y);
for i = 1:32
my_exp.x= i;
my_exp.y= i*i;
end
my_exp
How do I create an array in struct to keep track of all my_exp?
My code
my_exp=struct(x, y);
for i = 1:32
my_exp.x= i;
my_exp.y= i*i;
end
my_exp
Make sure you initialize your structure properly. You want to do:
my_exp=struct('x',[],'y',[])
for i = 1:32
my_exp.x= [my_exp.x i];
my_exp.y= [my_exp.x i*i];
end
my_exp