how to replace readcell by xlsread?

3 ビュー (過去 30 日間)
Pierre
Pierre 2022 年 8 月 23 日
コメント済み: Pierre 2022 年 8 月 23 日
Hello,
I am use to use readcell which seems to be very efficient for specific reading. for example var=readcell(xlx,'Sheet','MAIN','Range',[6,2,6,3]);
Is there a way to use xlsread in a simular way? like var=xlsread(xlx,'Sheet','MAIN','Range',[6,2,6,3]);
I tried and it did not work.
I really need the range to be represented by numbers not letters
Thank you

採用された回答

dpb
dpb 2022 年 8 月 23 日
編集済み: dpb 2022 年 8 月 23 日
"xlsread is not recommended. Use readtable, readmatrix, or readcell instead."
You apparently also did not read the documentation for xlsread -- besides being deprecated, it does NOT use the 'Range' named parameter as argument but the simple argument list form. But, that aside also, it only accepts the Excel range syntax in 'A1:C3' format; it can't interpret the four-vector form of [r1,r2,c1,c2] that the various readXXXX routines can.
To return numeric data, use readmatrix.
If the data are irregular and not all numeric as might be inferred from using readcell, then readtable may be a better choice. Would need to know the content of the spreadsheet and what is intended to be read from it to have precise and accurate answer to the specific case.
Either way, avoid going backwards to xlsread...
  2 件のコメント
Image Analyst
Image Analyst 2022 年 8 月 23 日
@Pierre this is good advice. I suggest you follow it. +1 vote.
Pierre
Pierre 2022 年 8 月 23 日
thank you, will do

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by