How do I create an app that I can import Excel data into?

조회 수: 4 (최근 30일)
Joseph Lesniak
Joseph Lesniak 2022년 6월 1일
답변: Voss 2022년 6월 2일
I want to use the app designer to make an app that provides an easy way to create graphs and tables for Excel data but I do not know how to go about inputting the files. Is there any way that an aplication can take you to the file explorer so you could choose what files to work with? If not, what would be the best way to input Excel matrices into an app?
  댓글 수: 2
Voss
Voss 2022년 6월 1일
"Is there any way that an aplication can take you to the file explorer so you could choose what files to work with?"
"what would be the best way to input Excel matrices into an app?"
Joseph Lesniak
Joseph Lesniak 2022년 6월 2일
Thanks I got it to work, but does the file I want to import always have to be in the MATLAB folder or in the folder the designed App is downloaded in?

댓글을 달려면 로그인하십시오.

답변 (1개)

Voss
Voss 2022년 6월 2일
"does the file I want to import always have to be in [a particular folder]"
No.
uigetfile lets the user select a file in any folder.
readmatrix/readtable allow you to specify full paths to files.
Example:
[file_name,path_name] = uigetfile('*.xlsx','Select an Excel File');
if ~ischar(file_name)
% if no file was selected (e.g., Cancel was clicked or file dialog
% was closed without making a selection), file_name and path_name
% are 0 -> don't do anything in that case
return
end
% construct full-path file name, e.g., 'C:\Users\JL\Documents\file1.xlsx'
full_file_name = fullfile(path_name,file_name);
% call the reading function on the file:
data = readtable(full_file_name);

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by