.MAT variables to list box

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일

0 개 추천

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일

0 개 추천

help load
help listdlg
help csvwrite

카테고리

도움말 센터File 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