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

6 次查看(过去 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?

采纳的回答

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

更多回答(1 个)

Cam Salzberger
Cam Salzberger 2019-12-5
编辑:Cam Salzberger 2019-12-5
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
  5 个评论

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by