MATLAB Answers


i'm writing an app to read data from excel file and plot the data with matlab app designer, is there any example i can refer to

Asked by vijayagopi r on 3 Dec 2018
Latest activity Commented on by vijayagopi r on 9 Dec 2018
i need to create a gui where the user can select an excel file with selected path and create plots with with various columns as x and y axes, i also need to provide with an dropdown menu for headings in column, is there any example cases that i can refer to?


Sign in to comment.




1 Answer

Answer by Kojiro Saito on 4 Dec 2018
Edited by Kojiro Saito on 5 Dec 2018

It's not Excel file, but MATLAB document has an Example of uigetfile and dropdown menu.
You can also open this example by the following command.
If you want to specify file extensions with .xlsx and read it as a table, the following will work.
[file, path] = uigetfile('*.xlsx');
t = readtable(fullfile(path, file));
I've attached a sample mlapp file (as a zip file) which sets drop down menu from input Excel file.


i need to provide an drop down menu where the user can read and select each column's id (of the excel file)
i want to know how to address the dropdown menu to the data associated with the excel file
I've updated my previous answer and attached a sample mlapp file.
Drop down menu can be created from input file as the following.
[file, path] = uigetfile('*.xlsx');
if isequal(file,0)
msgbox('Please input an Excel file')
t = readtable(fullfile(path, file));
app.UITable.Data = t;
% Set column names as a pull down menu
app.xDropDown.Items = t.Properties.VariableNames;

Sign in to comment.