xlsread with range of a column from specific row till the end

17 views (last 30 days)
Hi. Is it possible to use xlsread for a specific range (start at second row) until the end of that column?
Example:
xlsread('fileName', 'SheetName', 'A2:A')
Thanks in advance, best
Kajover

Accepted Answer

dpb
dpb on 12 Oct 2015
There is no Excel syntax expression equivalent to Matlab :end array references, no.
Read the column and trash the unwanted element or use a row ending reference that includes enough to ensure you "get 'er all". I think (but am not positive; don't use Excel that all that much) if there's not been data in trailing rows the return data will be the size of the data in the sheet or the trailing values will be filled with NaN. I suggest a few test cases to confirm actual behavior if that's of concern, but think the easiest is the first option by far.
  1 Comment
KAE
KAE on 1 Mar 2017
In R2016b, the trailing values are empty ('') if you read it in as a cell array. Then you can delete the empty cells afterward.

Sign in to comment.

More Answers (0)

Categories

Find more on Data Import from MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!