readmatrix for single Excel cells
5 次查看(过去 30 天)
显示 更早的评论
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 个评论
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
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:
- Just follow above with MFOA=MFOA(1); to throw away everything but first element, or
- Use venerable xlsread to read the single cell cases (I'd use 1. btw).
2 个评论
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!