Borrar filtros
Borrar filtros

save instruction

1 visualización (últimos 30 días)
Neeta
Neeta el 12 de Mzo. de 2012
Hi, This is an elementary question related to Matlab Programming. I am using a loop in main body of program and this loop execute 50 times for "x" variable. I would like to save values of "x" in a mat file after each execution. If I am using save ("filename", x) within the loop it saves only last value of the variable "x". Please let me know, can I save each value of "x" in a file (like a vector). Do you think I need to make a data set. Thank you, Neeta

Respuesta aceptada

Thomas
Thomas el 12 de Mzo. de 2012
You would rather do well to save the data in a vector than write a mat file every time the loop runs:
This video should help:
You can save the output in a vector or matrix as shown,
Eg:
for i=1:10
y(i)=i+rand; % use y(i) so that it is written as a vector
end
or you could use:
z=[];
for i=1:10
z=[z i+rand];
end

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by