Borrar filtros
Borrar filtros

Append variables in mat file

17 visualizaciones (últimos 30 días)
Toke Søltoft
Toke Søltoft el 29 de Jul. de 2014
Respondida: erdinc el 17 de Nov. de 2022
Making a simple example, where I load a .mat file to append to a variable. How do I then save the .mat file again after the appending?
current = [1 2 3];
new_current = [4 7];
volt = [7 5 4];
save('data.mat','current','volt');
data = load('data.mat');
data.current = [data.current new_current];
save .matfile?!?!!

Respuestas (3)

ES
ES el 29 de Jul. de 2014
Editada: ES el 29 de Jul. de 2014
save(FILENAME, ..., '-append') adds new variables to an existing file.
in your case,
save('data.mat','new_current','-append');

Toke
Toke el 29 de Jul. de 2014
Hi.
Thanks for the answer but that is not what I want. I want to replace data.current with the new data.current I have made from:
data.current = [data.current new_current];

erdinc
erdinc el 17 de Nov. de 2022
current = [1 2 3];
new_current = [4 7];
volt = [7 5 4];
save('data.mat','current','volt');
load('data.mat','current');
current = [current new_current];
save(file,'current','-append')

Categorías

Más información sobre Semiconductors and Converters en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by