How Can I Save Some Fields of a Struct Using uisave Function?

6 ビュー (過去 30 日間)
Rightia Rollmann
Rightia Rollmann 2017 年 3 月 17 日
編集済み: Guillaume 2017 年 3 月 17 日
I want to save some fields of a struct using uisave function. The problem is uisave doesn’t have the options that save function provides.
How can I save some fields of a struct using uisave function? If not possible, what is the alternate solution?
  1 件のコメント
Jan
Jan 2017 年 3 月 17 日
How do you want to specify the fields? What about using the save function directly?

サインインしてコメントする。

回答 (1 件)

Guillaume
Guillaume 2017 年 3 月 17 日
編集済み: Guillaume 2017 年 3 月 17 日
Simply use uiputfile instead of uisave then use the returned path with save. It's only three more lines of code.
[filename, filepath] = uiputfile({'*.mat', 'MAT-files (*.mat)'}, 'Save Workspace Variable', 'matlab.mat');
if ischar(filename)
save(fullfile(filepath, filename), '-struct', 'somestructvariable');
end
edit: you can actually look at the code of uiputfile (simply use edit uiputfile). You'll see it's more or less what I've written.

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by