Selecting a sheet from an excel file in Matlab GUI

4 views (last 30 days)
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)

Accepted Answer

Cris LaPierre
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.
  1 Comment
Rafael Ferdinandus
Rafael Ferdinandus on 3 Apr 2021
ah i see. i've found another thread that discuss about this stuff too so i'll look up, but thak you bery much for the answer

Sign in to comment.

More Answers (0)

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!