Effacer les filtres
Effacer les filtres

How to read & display an excel file (using a button to select the file)?

6 vues (au cours des 30 derniers jours)
poornima tumkur nataraj
poornima tumkur nataraj le 27 Oct 2021
Commenté : VBBV le 27 Oct 2021
[file,path]= uigetfile({'*.*'},...
'select a file',app.filepath);
app.button1.Value= file;
t =xlsread('C:\Users\t.xlsx','sheet_3','A1:AA4');
I am trying this code, to read and display(in edit field) a selected file from a file explorer as soon as I click the 'Button1'.
I am able to display the file name, but the data in the file is not read (when I run the code and see in the command window).
Kindly, let me know where am I going wrong?

Réponses (1)

VBBV
VBBV le 27 Oct 2021
%if true
[N TT R] =xlsread('C:\Users\t.xlsx','sheet_3','A1:AA4');% Try to change the out
It seems you have the excel file name and variable to which you are reading in workspace are same. Also check if the sheet with name sheet_3 exists in the file.
  1 commentaire
VBBV
VBBV le 27 Oct 2021
Recommended function is readmatrix from Matlab. Try it.

Connectez-vous pour commenter.

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by