how do i save looped output into 1 variable matrix
Show older comments
c=19;
>> D=[];
>> for k=1:c;
Z=[X(:,1),Y(:,1)];
p=anova1(Z)
D=save(p)
X(:,1)=[];Y(:,1)=[];
end
4 Comments
James Kristoff
on 9 May 2013
Can you please clarify you are asking for?
the code snippet you shared:
c=19;
D=[];
for k=1:c;
Z=[X(:,1),Y(:,1)];
p=anova1(Z)
D=save(p)
X(:,1)=[];Y(:,1)=[];
end
does not have a clear intent. There is a FOR loop, but you are not using the looping variable k anywhere in the loop.
Also, I am not sure what you mean by save, or 1 variable matrix.
john borsellino
on 10 May 2013
john borsellino
on 10 May 2013
john borsellino
on 10 May 2013
Accepted Answer
More Answers (1)
bym
on 9 May 2013
c=19;
% D=[];
p = zeros(c,1); % preallocate
for k=1:c;
Z=[X(:,1),Y(:,1)];
p(k)=anova1(Z);
%D=save(p) unecessary
%X(:,1)=[];Y(:,1)=[]; don't change X or Y!
end
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!