making a vector of cells
1 view (last 30 days)
Show older comments
i have a project making a GUI i work on
my GUI has to open a CSV file that had 5000+ rows of info about countries and allow the user to plot info by choise
for example - choose USA, then plot popolation and birthrate (as X and Y)
in my CVS the first column is country, when i read it with readtable i have it as cells that have a string.
i want to create a short vector that only have the names once to use it in my Popupmenu as the list of countries
how can i poll the info easily once to a cell vectore that i can later use as a long string?
thank you!
0 Comments
Accepted Answer
dpb
on 5 Jan 2021
Probably good choice would be to convert the country string/column in the table into a categorical variable; makes for looking for a match simpler than using string comparisons by the "==" operator, for example.
To create the list for your UI,
countriesList=unique(tYourTable.Country);
This will give you an alphabetically-sorted list automagically.
More Answers (0)
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!