Effacer les filtres
Effacer les filtres

Reading of Excel files in MATLAB_R2016 vs MATLAB_R2018

2 vues (au cours des 30 derniers jours)
Thishan Dharshana Karandana Gamalathge
Commenté : Walter Roberson le 21 Juin 2018
When i am trying to extract data using the command [num_1,txt_1]= xlsread('test','Sheet1'), R2016 version considers the 1st row (which is column headers) too, despite it shows NaN. At the same time R2018 version correctly extract numbers starting the seconds row. So I cannot use the same program to extract data in two MATLAB versions. What is the reason?
  1 commentaire
Walter Roberson
Walter Roberson le 21 Juin 2018
Could you attach the .xls, just in case there is something odd about it?
The num output of xlsread() was always intended to omit all leading and trailing rows and columns that have no entries that can be interpreted as numbers. Like
nn = isnan(converted_data);
nnr = ~all(nn, 2);
sr = find(nnr, 1, 'first');
er = find(nnr, 1, 'last');
nnc = ~all(nn, 1);
sc = find(nnc, 1, 'first');
ec = find(nnc, 1, 'last');
num = converted_data(sr:er, sc:ec);

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by