How do i put the content of a cell array into a List Box in appdesigner?
1 回表示 (過去 30 日間)
古いコメントを表示
Hello, i want to put the content of a cell array into a List Box in Appdesigner. Up to now only the name of the cell array is shown in the List Box.
I saved an m-file as a .mat-file and load it with uigetfile(). The variable in the m-file is called "Bus_stops"
Here you can see my code in Appdesigner:
function FileHinzufgenButtonPushed(app, event)
Bus_stops = uigetfile('.mat','Select the Matlab Code File');
varlist = who('-file',Bus_stops);
app.stopList.Items = varlist;
end
Here you can see my m-file
%%Busshaltestellen
Bus_stops = {'Steenbeker Weg';'Hauptbahnhof';'Fachhochschule'} %Thats all
So as you can see there is the variable with its content. Now i want to put it into a list box in my appdesigner GUI.
I would be very thankful for your help.
2 件のコメント
Achyutha Hosahalli
2017 年 10 月 5 日
Instead of doing
Bus_stops = uigetfile('.mat','Select the Matlab Code File');
varlist = who('-file',Bus_stops);
app.stopList.Items = varlist;
which would give just the variable name but not the contents of it and display the same, doing
busStopsFile = uigetfile('.mat','Select the Matlab Code File');
varlist = load(busStopFile);
app.stopList.Items = varlist.Bus_stops;
should help u to get the contents of the variable and display the same
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Environment and Settings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!