Azzera filtri
Azzera filtri

Find string in excel file

9 visualizzazioni (ultimi 30 giorni)
Adrian Pielmeier
Adrian Pielmeier il 25 Giu 2018
Modificato: darova il 29 Apr 2020
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');

Risposte (2)

Paolo
Paolo il 25 Giu 2018
Modificato: Paolo il 25 Giu 2018
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 Commenti
Paolo
Paolo il 25 Giu 2018
indx = strcmp(rawData(:,1),'T_DCT_PK_WDT_W01B1_RANGE');
Rohan Singla
Rohan Singla il 29 Apr 2020
can we also find the row and column number at which our string was present?

Accedi per commentare.


Ahmed Elsherif
Ahmed Elsherif il 23 Nov 2018
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);

Community Treasure Hunt

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

Start Hunting!

Translated by