Selecting a sheet from an excel file in Matlab GUI
4 views (last 30 days)
Show older comments
Rafael Ferdinandus
on 30 Mar 2021
Commented: Rafael Ferdinandus
on 3 Apr 2021
Hey, I'm new with Matlab GUI. i was wondering is it possible to load/select a sheet you want to plot in Matlab GUI from a file with multiple sheets? if it isn't possible, then what's the best alternative to this issue?
like this one, i want to use uigetfile code, but i can't choose/write to use a sheet from a mulitple-sheets file
handles.filename=uigetfile('*.xlsx');
filename=handles.filename;
set(handles.edit1,'String', filename)
0 Comments
Accepted Answer
Cris LaPierre
on 30 Mar 2021
Uigetfile lets you select a file. I suggest using readmatrix or readtable, which allow you to specify which sheet to import using the name or a number. You would have to create your own way of letting the user select the sheet, perhaps through a drop down menu or numeric spinner, etc.
You can use sheetnames to capture the names of the sheets in the spreadsheet you have selected. Use the string array it returns to populate your uicontrol, or its length to same the max numeric value.
More Answers (0)
See Also
Categories
Find more on Environment and Settings 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!