How to store iterative information to a matrix?

1 visualización (últimos 30 días)
Sweet Nemesis
Sweet Nemesis el 18 de Oct. de 2021
Respondida: Matt J el 18 de Oct. de 2021
I have the following code structure:
while y ~= 0 %y will converge to zero eventually
[x,y] = somefunction(a,b);
iteration = iteration + 1;
this_row(iteration, y);
end
What is the best way to store "this_row" so it can be used for a table or graph?

Respuestas (1)

Matt J
Matt J el 18 de Oct. de 2021
The following is pretty typical.
result=nan(big_number,1);
while abs(y)>=small_number &iteration<big_number
[x,y] = somefunction(a,b);
iteration = iteration + 1;
result(iteration)=this_row(iteration, y);
end

Categorías

Más información sobre Logical en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by