How to automically read data from excel file
2 views (last 30 days)
Show older comments
Chao Zhang
on 20 May 2021
Answered: Cris LaPierre
on 20 May 2021
I am newer to learn Matlab, so I would like to ask for some help.
I use 'menu' function to create 3 buttons, such as 'A', 'B', and 'exit the program', and I want to automically select and read the dataset of different excel files when users click button A or B, and users then can use the dataset in the workspace to do some computations.
For this purpose, i then create function A and function B respectively, the following example is function A:
function A(data, position)
%data.name is the appropriate excel file, pathname is the position of file
%specifies the type of file that can be selected
[data.filename, pathname]=...
uigetfile({'*.xlsx';'*.xls';'*.*'},'File Selector');
pathname=string(pathname);
data.filename=string(data.filename);
if isequal(data.filename,0)||isequal(pathname,0)
return
else
data.fileText.Value=pathname+data.filename;
end
but i have no idea how to read the dataset and use them after i run this code and select the excel file,
so how to accomplish this goal?
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!