Borrar filtros
Borrar filtros

how to save variable value neatly

5 visualizaciones (últimos 30 días)
xueqi
xueqi el 27 de Mayo de 2013
Hi, I am trying to save variables in matlab and I find that matlab always save all the files related to this this variables. For example, a=b*3. Then I save a. But when I load a, b appears in the workplace too. It is annoying when there are loads of b. Is anyone how to deal with the situation that I only want to store the value of a?

Respuesta aceptada

Image Analyst
Image Analyst el 27 de Mayo de 2013
What was your code? If you do
save(fullMatFileName, 'a');
Then is will only save a and no other variables. What did you do? To retrieve
storedStructure = load(fullMatFileName); % Get everything that was stored.
a = storedStructure.a; % Retrieve a.
  1 comentario
xueqi
xueqi el 27 de Mayo de 2013
Editada: xueqi el 27 de Mayo de 2013
Yes by doing this
if true
% save(fullMatFileName, 'a');
end
it does only save the variable a. But a is existing in the file named as fullMatFileName. I guess it is a variable must be existing in a mat file instead of being existing independently as a mat file. Is that right?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Workspace Variables and MAT-Files 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