Saving a variable value after each for-loop iteration

Answers (1)

Initialize a variable for counter and a variable to save values of p (suppose pp) in the start of code (before for loop) . Increment counter every iteration and save values of p in pp by indexing it with counter such that in 1st loop iteration
pp(1) = p;
and in 2nd loop iteration
pp(2) = p;
and goes on

Categories

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

Tags

Asked:

on 7 May 2020

Edited:

on 7 May 2020

Community Treasure Hunt

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

Start Hunting!