How do i put the content of a cell array into a List Box in appdesigner?

2 vues (au cours des 30 derniers jours)
Nils Waap
Nils Waap le 2 Oct 2017
Commenté : Nils Waap le 9 Oct 2017
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
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
Nils Waap
Nils Waap le 9 Oct 2017
Thanks a lot. That really helped me! best regards

Connectez-vous pour commenter.

Réponses (0)

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!

Translated by