필터 지우기
필터 지우기

How to convert my xlsread function to readmatrix function

조회 수: 2 (최근 30일)
Hong Wei Tang
Hong Wei Tang 2021년 6월 22일
댓글: Cris LaPierre 2021년 6월 22일
Greetings,
I have a question about the input from Excel to MATLAB.
Here is my original code:
A = xlsread("Weather.xlsx", "WeatherData", "B2");
This function can actually help me to input a single cell value from Excel. However, I discovered that readmatrix was encouraged to be used, so that I plan to switch to it.
I amended the new code afterwards. Here is it:
A = readmatrix("Weather.xlsx", "sheet", "WeatherData", "Range", "B2");
but it displayed error in the end.
Therefore, I tried again to amende the code to be:
A = readmatrix("Weather.xlsx", "sheet", "WeatherData", "Range", "B2:B2");
But it takes me extremely long time to load. And I decided to stop it in the end.
I am here to ask that is the last coding correct? Otherwise do we have any function to express the same input?
Thanks. Have a great day!
  댓글 수: 2
Scott MacKenzie
Scott MacKenzie 2021년 6월 22일
This
A = readmatrix("Weather.xlsx", "sheet", "WeatherData", "Range", "B2");
looks fine. What's the exact and complete error you are seeing?
Cris LaPierre
Cris LaPierre 2021년 6월 22일
What type of data does Column B contain?

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by