Reading specific Cell in Excel

조회 수: 171 (최근 30일)
Russell
Russell 2014년 5월 30일
댓글: NAFTALI HERSCOVICI 2022년 5월 29일
I am trying to read a certain cell in Excel with matlab.(B2)
I am then going to use this in an if statement.
Please advise

답변 (3개)

Mahdi
Mahdi 2014년 5월 30일
편집: Mahdi 2014년 5월 30일
Have you looked at the xlsread documentation? It tells you exactly how to do it.
Example:
filename='hello.xls' #Name of file
x=xlsread(filename, 'B2')

Lotus Kannan
Lotus Kannan 2017년 3월 14일
%% x only reads B column values from the excel
filename='example.xlsx';
x = xlsread(filename,'B:B');

Shirin Mozaffari
Shirin Mozaffari 2018년 7월 18일
for example you wanna read cell A2. This is what you should do: cell = xlsread(fileName,'A2:A2')
  댓글 수: 2
Jesus Leal
Jesus Leal 2022년 3월 13일
what if i wanted to recall a cell and every 6th cell after that
NAFTALI HERSCOVICI
NAFTALI HERSCOVICI 2022년 5월 29일
Is there any way to use the cell indices rather than letters to specify columns?
Like in excel the range can be defined as Range(cells(2,1),cells(2,1)) instead of Range("a2:a2")

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

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by