.MAT variables to list box

4 visualizaciones (últimos 30 días)
William
William el 9 de Jun. de 2011
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.

Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 9 de Jun. de 2011
This should get you started.
MatFile=uigetfile('*.mat');
MyVar=load(MatFile);
VarNames=fieldnames(MyVar);
  2 comentarios
William
William el 10 de Jun. de 2011
Do I need to use any of the set(handle. ' _____' ) commands? Thanks!
Fangjun Jiang
Fangjun Jiang el 10 de Jun. de 2011
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);

Iniciar sesión para comentar.

Más respuestas (1)

Robert Cumming
Robert Cumming el 9 de Jun. de 2011
help load
help listdlg
help csvwrite

Categorías

Más información sobre Workspace Variables and MAT Files en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by