How to get column and row number while searching for specific text in excel.

조회 수: 4 (최근 30일)
Priyanka P
Priyanka P 2017년 11월 2일
댓글: Priyanka P 2018년 3월 11일
Get column number and Row number from excel with matched input text

답변 (1개)

Astarag Chattopadhyay
Astarag Chattopadhyay 2017년 11월 10일
Hi,
You can use the following code snippet to find out the column number and the row number of a matching string in an Excelsheet:
[data,txt] = xlsread('filename.xlsx');
num = find(contains(txt(:,:),'string to find'));
colNum = ceil(num/s(1))
rowNum = num - s(1)*(colNum-1)
Here give your Excel file name as the input in "xlsread". 'txt' contains all the data as xell array. 'num' finds the location of the string (assumption: the string is present within the file). 'colNum' and 'rowNum' calculates the corresponding column and row number of the string.
  댓글 수: 1
Priyanka P
Priyanka P 2018년 3월 11일
rowNum doesnt match with expected rowNum. s() for excel sheet seems not a good idea?

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

카테고리

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