How do i put the content of a cell array into a List Box in appdesigner?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Achyutha Hosahalli
le 5 Oct 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
Réponses (0)
Voir également
Catégories
En savoir plus sur Environment and Settings dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!