フィルターのクリア

Delete and replace a struct in a mat file

20 ビュー (過去 30 日間)
Honey
Honey 2020 年 4 月 10 日
回答済み: Stephen23 2020 年 4 月 11 日
Hi ,
I have a mat file with 22 1*1 struct. It took a long time to run all of it. I found that one of the variabels in one of my struct is not correct. I just wanted to replace this by another one which I ran it. Is it possible to replace?
what is the code for doing this?
Thank you in advance.

回答 (2 件)

Ameer Hamza
Ameer Hamza 2020 年 4 月 10 日
See matfile: https://www.mathworks.com/help/matlab/ref/matlab.io.matfile.html. It allows making modifications to .mat file without completing loading it. Note that it does not allow to modify struct without completing loading it, so you will at least need to load one of the structs you are trying to modify.

Stephen23
Stephen23 2020 年 4 月 11 日
You can simply use the -append option, e.g. where var is the variable that you want to replace:
var = [...];
fnm = 'name of the file.mat';
save(fnm,'var','-append')

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT-Files についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by