MATLAB Answers

readmatrix for single Excel cells

23 views (last 30 days)
Kar Moh
Kar Moh on 26 Dec 2019
Answered: dpb on 26 Dec 2019
My data is stored on a single Excel file, where each sheet containts several numeric matrixes. I imported all the variables successfully to MATLAB using readmatrix. However, 1x1 matrices are imported incorrectly. I use the following syntax:
MFOA = readmatrix (Path, 'Sheet', Sheet, 'Range', 'H142:H142');
Instead of loading only the cell H142, readmatrix loads a column vector starting from H142 down to the last row of the rectangular portion of the spreadsheet. How can I get the correct results?


Sign in to comment.

Accepted Answer

dpb on 26 Dec 2019
Don't have recent-enough version here to test to confirm, but if is so and reproducible on latest release, that would appear to be a bug. Report to TMW.
  1. Just follow above with MFOA=MFOA(1); to throw away everything but first element, or
  2. Use venerable xlsread to read the single cell cases (I'd use 1. btw).


Sign in to comment.

More Answers (0)

Sign in to answer this question.





Translated by