MATLAB Answers

How can I select a specific variable in the .mat file which contains different variables in the user interface?

조회 수: 1(최근 30일)
Hi! I want to design an app which can draw with a .mat file. How can I select a specific variable in the .mat file which contains different variables in the user interface? By 'text area' or something?

  댓글 수: 0

로그인 to comment.

채택된 답변

Fangjun Jiang
Fangjun Jiang 5 Dec 2019
  1. Use load() with return structure.
gongStruct = load('gong.mat');
fieldnames(gongStruct)
  1. Use matfile object.
Help matfile

  댓글 수: 0

로그인 to comment.

More Answers (1)

Cam Salzberger
Cam Salzberger 5 Dec 2019
Cam Salzberger 님이 편집함. 5 Dec 2019
Hello Kunpeng,
You may consider using whos to determine the variables available in a MAT file. Then you can specify the variable you want when you call load based on the user selection. This will be faster than loading the entire MAT file into the workspace, unless you expect the user to frequently switch between what they want loaded.
You may also consider checking out the matfile object, as Fangjun suggested.
-Cam

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by