How to append a variable to a .mat file?

与世无争的帅哥 提交于 2019-12-07 18:06:55

问题


If I already have a .mat file with the variables x and y, is there a way to use the save command to add another variable z to the .mat file without having to explicitly state the variables x and y in the save command?


回答1:


If you look at the save() function documentation, there is a form of the save command that might help:

save(filename, ..., '-append')

The help for this form says:

save(filename, ..., '-append') adds new variables to an existing file. You can specify the '-append' option with additional inputs such as variables, '-struct' , format, or version.




回答2:


From the manual page:

save(filename)
save(filename, variables)
save(filename, '-struct', structName, fieldNames)
save(filename, ..., '-append')
save(filename, ..., format)
save(filename, ..., version)
save filename ...

...

save(filename, ..., '-append') adds new variables to an existing file. You can specify the '-append' option with additional inputs such as variables, '-struct' , format, or version.



来源:https://stackoverflow.com/questions/8509315/how-to-append-a-variable-to-a-mat-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!