필터 지우기
필터 지우기

Find string in excel file

조회 수: 9 (최근 30일)
Adrian Pielmeier
Adrian Pielmeier 2018년 6월 25일
편집: darova 2020년 4월 29일
Hello
i have got an excel file with this coloum example:
T_DCT_PK_WDT_W01B1_RANGE
T_DCT_PK_WDT_W01B2_RANGE
T_DCT_PK_WDT_W02B1_RANGE
T_DCT_PK_WDT_W02B2_RANGE
and so on.
Now i would like to search for example T_DCT_PK_WDT_W01B2_RANGE
So if(T_DCT_PK_WDT_W01B2_RANGE is found) then ....
how can i do this? This doesnt work for me:
num = xlsread ( 'T_APC_RUNKEYNUMBER_test.xlsx' );
k = strfind(num, 'T_DCT_PK_WDT_W01B2_RANGE');

답변 (2개)

Paolo
Paolo 2018년 6월 25일
편집: Paolo 2018년 6월 25일
text = {'T_DCT_PK_WDT_W01B1_RANGE';
'T_DCT_PK_WDT_W01B2_RANGE';
'T_DCT_PK_WDT_W02B1_RANGE';
'T_DCT_PK_WDT_W02B2_RANGE'}
indx = strcmp(text,'T_DCT_PK_WDT_W01B2_RANGE')
if any(indx)
%your logic
end
  댓글 수: 9
Paolo
Paolo 2018년 6월 25일
indx = strcmp(rawData(:,1),'T_DCT_PK_WDT_W01B1_RANGE');
Rohan Singla
Rohan Singla 2020년 4월 29일
can we also find the row and column number at which our string was present?

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


Ahmed Elsherif
Ahmed Elsherif 2018년 11월 23일
Hi,
I have something similar as I am looking for a value under a certain header in GUI. In principle, it works but it prints a wrong value! I mean it shows the value in the third column after the desired one although it prints '1' for the correct position.
Whould you please help me why?
Thanks in advance.
My sub-code is:
handles.fileName = uigetfile ('.xlsx')
[data, text] = xlsread('input');
idx = strcmpi(text(1,:),'headertobefound')
k=data(:,idx);
set(handles.edit40,'string',k);

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by