MATLAB Answers

0

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?

  0 Comments

Sign in to comment.

Products


Release

R2018b

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.
openExample('matlab/AppdImageHistogramsExample')
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));
UPDATED
I've attached a sample mlapp file (as a zip file) which sets drop down menu from input Excel file.
2018125213718.jpg

  3 Comments

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')
else
t = readtable(fullfile(path, file));
app.UITable.Data = t;
% Set column names as a pull down menu
app.xDropDown.Items = t.Properties.VariableNames;
end

Sign in to comment.