How do i put the content of a cell array into a List Box in appdesigner?
2 次查看(过去 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!