Clear Filters
Clear Filters

save for loop resutls

2 views (last 30 days)
heir ancestors
heir ancestors on 19 Jun 2017
Commented: heir ancestors on 21 Jun 2017
hello everybody ,
I have a small code , I want to save the values of ab so in newwidt so that I can call them later newwidt(1) ,newwidt(2) ....etc
Sn is a 7*9 matrix , the results are not saving, I know it false as I wrote (saving part).
[a,b]=size(Sn);
newwidt=zeros(size(Sn));
for i=1:b
ab=repmat(Sn(:,i),1,b)
newwidt=ab(:,:)
end
thanks

Accepted Answer

aborghes
aborghes on 19 Jun 2017
does changing newwidt=ab(:,:) to newwidt(:)=ab(:,:) do what you are looking for? This saves each value in an array of doubles.
  3 Comments
aborghes
aborghes on 19 Jun 2017
sorry about that, i miss-typed. try newwidt(:,:,i). that saves each result in a new array that are all accessible.
heir ancestors
heir ancestors on 21 Jun 2017
Amazing !! it's woking, thank you very much :)

Sign in to comment.

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!