User input from an excel file
조회 수: 10 (최근 30일)
이전 댓글 표시
I want the program to prompt a dialog box asking the user to specify which file should be selected for a particular variable eg. in my case I want the user to give me and excel file (.xlsx) with info for the x coordinates for a grid system. After the user specifies the file, I want the program to read the excel file and echo print the data selected.
댓글 수: 0
채택된 답변
Jan
2017년 3월 7일
편집: Jan
2017년 3월 7일
BaseDir = 'C:\Temp'; % Set as you need
[FileName, FilePath] = uigetfile('*.xlsx', ...
'Please choose an Excel file', BaseDir);
if isequal(filename, 0)
disp('User aborted file choosing.');
return; % Assuming this is a function
end
File = fullfile(FilePath, FileName);
[Num, Txt, Raw] = xlsread(File);
Now it is not clear where the wanted values are found in the Excel file. I assume you find the values in a column of Num.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!