readmatrix for single Excel cells

조회 수: 5 (최근 30일)
Abdolkarim Mohammadi
Abdolkarim Mohammadi 2019년 12월 26일
댓글: dpb 2020년 6월 1일
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?
  댓글 수: 2
Vit Krcal
Vit Krcal 2020년 5월 19일
I have the same issue, have you found out any new solution or reasoning?
dpb
dpb 2020년 5월 19일
It's a bug; the workarounds are simple enough, but never hurts to submit additional bug report to prod TMW along in fixing stuff...

댓글을 달려면 로그인하십시오.

채택된 답변

dpb
dpb 2019년 12월 26일
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.
Workarounds:
  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).
  댓글 수: 2
ziyue zhong
ziyue zhong 2020년 6월 1일
Then how to deal with that if I use write,and I wanna write a single value in a single cell
dpb
dpb 2020년 6월 1일
With what, specifically? If there's only one value, doesn't it work correctly?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by