Issue with reading text value from a cell in MS Excel using readmatrix

30 次查看(过去 30 天)
I am trying to read a text data in a cell in Excel to a variable in Matlab using the "readmatrix" command. I am using the following syntax.
readmatrix("ABC.xlsx","Sheet",'S1',"Range",'N1:N1')
But it is reading NaN value instead of the actual text. If I change the cell location (range) to another cell containing numeric data it is reading correctly. But only in case of text data this is happening. Kindly help me in resolving this issue. Thank you.

采纳的回答

Jonas
Jonas 2022-8-8
if i am not mistaken, readmatrix expects numbers for each entry, so the numbers can be but into a matrix. if your data contains numbers and text (multiple characters per cell), try readcell instead
  1 个评论
Subraya Krishna Bhat
Thank you very much for your answer! Now I am able to read the text value from Excel. I used readcell as follows with similar syntax as readmatrix:
readcell("ABC.xlsx","Sheet",'S2','Range','N1:N1')

请先登录,再进行评论。

更多回答(0 个)

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by