Reading of Excel files in MATLAB_R2016 vs MATLAB_R2018

2 次查看(过去 30 天)
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 个评论
Walter Roberson
Walter Roberson 2018-6-21
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);

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by