フィルターのクリア

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 Center および File ExchangeSemiconductors and Converters についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by