.MAT variables to list box

1 次查看(过去 30 天)
I am trying to list the contents of a .MAT file in a list box. to choose which one to import into a CSV file. I am currently using a uiget command that outputs the .MAT file as a string. How do I access the contents of the .MAT file and export them to a list box? I am using 2007b
Thank you.

采纳的回答

Fangjun Jiang
Fangjun Jiang 2011-6-9
This should get you started.
MatFile=uigetfile('*.mat');
MyVar=load(MatFile);
VarNames=fieldnames(MyVar);
  2 个评论
William
William 2011-6-10
Do I need to use any of the set(handle. ' _____' ) commands? Thanks!
Fangjun Jiang
Fangjun Jiang 2011-6-10
The above lines give you the variable names in your .mat file. You probably will need to use set() to put them into your listbox.
h=uicontrol('style','listbox','Position',[20 20 100 100]);
set(h,'string',VarNames);

请先登录,再进行评论。

更多回答(1 个)

Robert Cumming
Robert Cumming 2011-6-9
help load
help listdlg
help csvwrite

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by