User input from an excel file

11 vues (au cours des 30 derniers jours)
Kshitij D
Kshitij D le 7 Mar 2017
Commenté : Kshitij D le 7 Mar 2017
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.

Réponse acceptée

Jan
Jan le 7 Mar 2017
Modifié(e) : Jan le 7 Mar 2017
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.
  1 commentaire
Kshitij D
Kshitij D le 7 Mar 2017
Thanks

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Import from MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by