필터 지우기
필터 지우기

Append variables in mat file

조회 수: 17 (최근 30일)
Toke Søltoft
Toke Søltoft 2014년 7월 29일
답변: erdinc 2022년 11월 17일
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?!?!!

답변 (3개)

ES
ES 2014년 7월 29일
편집: ES 2014년 7월 29일
save(FILENAME, ..., '-append') adds new variables to an existing file.
in your case,
save('data.mat','new_current','-append');

Toke
Toke 2014년 7월 29일
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 2022년 11월 17일
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')

카테고리

Help CenterFile Exchange에서 Semiconductors and Converters에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by