How To Sort Excel Sheet By Address In GUI
1 view (last 30 days)
Show older comments
Hello,
I have an excel sheet that I have imported into MATLAB using the import tool. The Excel sheet has multiple types of cells, both numbers, characters, and both characters and numbers. (e.g. one column is either 'hip' or 'gable', another is simply numbers from 0-9, and a third is a combination of characters and numbers like '1000 Main St.')
In my code, I have each street listed in a listbox, and I've written "if" statements for each Value in the listbox. I can sort into a table the way I want with the column that only has numbers, but for mixed char/numbers and solely char, I cannot do it.
Here is a snippet of the code I have that works for the numbers (0-9):
%Import dataset in the GUI Opening Function. import1 is the function the Import Data created.
imported = import1('ExcelFile.XLSX','Complete Excel File DATA',1,713);
handles.Table = imported;
%listbox code
a = get(handles.SortRating,'Value');
T = handles.Table;
if (a==1)
%Table Creation for Ratings = 0
Rating0 = T.Rating<1;
names0 = {'Rating', 'Var2', 'Var3' , ....};
T0 = T(Rating0,names0);
table0 = table2cell(T0);
finaltable0 = [T.Properties.VariableNames; table0];
set(handles.uitable1,'Data', finaltable0 );
end
The above code displays all the data from the excel file for all Ratings = 0 in the excel sheet. As I said previously, I need this for char. and char. w/ numbers. Your help is appreciated!
Also, as a side note - Would this work better as a table or a structure? I have imported it as a table because it was what I know best.
4 Comments
Jan
on 25 Jul 2017
@Mark M: "Cite"? This function is published in the FileExchange and covered by the BSD license. Keep the license file beside the function. Or what do you mean by "citing"?
I do not understand the problem of picking "subsections". How are these sections defined?
Answers (0)
See Also
Categories
Find more on Data Import from MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!