How do i put the content of a cell array into a List Box in appdesigner?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Achyutha Hosahalli
am 5 Okt. 2017
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
Antworten (0)
Siehe auch
Kategorien
Mehr zu Environment and Settings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!