Reading of Excel files in MATLAB_R2016 vs MATLAB_R2018

1 view (last 30 days)
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 Comment
Walter Roberson
Walter Roberson on 21 Jun 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);

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!