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

조회 수: 8 (최근 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 CenterFile Exchange에서 Develop uifigure-Based Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by