How do I create an app that I can import Excel data into?
조회 수: 4 (최근 30일)
이전 댓글 표시
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
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?"
See: uigetfile
"what would be the best way to input Excel matrices into an app?"
답변 (1개)
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);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!