Write to a file in fileEnsembleDatastore

1 回表示 (過去 30 日間)
M. Mubashir Hussain
M. Mubashir Hussain 2019 年 5 月 15 日
回答済み: Alec Stothert 2019 年 12 月 17 日
Hello! in the relevant examples for writing data to files in fileEnsembleDatastore, the write function has the format:
function writeNewData(filename,data)
save(filename, '-append', '-struct', 'data');
end
What if I want to write variable names using save like:
save(filename,variables,'-append')
Kindly guide how I will use the writeToLastMemberRead function to save the variables to files in fileEnsembleDatastore instead of saving data in structure form as required by the format of the writeNewData function given above.

回答 (1 件)

Alec Stothert
Alec Stothert 2019 年 12 月 17 日
Using save(filename,variables,'-append') is fine. The format save(filename, '-append', '-struct', 'data'); saves the fields of the stuct data as individual variables in the mat file, see "Save Structure Fields as Individual Variables" on the save help page https://www.mathworks.com/help/matlab/ref/save.html

カテゴリ

Help Center および File ExchangeTables についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by