In an excel sheet, how can I extract the rows which contain a specific string data called (T1L2). this variable happens only in the second column (conditions). Thanks

2 views (last 30 days)
I start with this commands:
[num,text,raw]=xlsread('filename.xlsx',1);
conditions=raw(:,2);
but then I don't know how to select the rows which contain the this word (T1L2) in their second column.

Accepted Answer

Cedric
Cedric on 21 Nov 2013
Here is an example:
>> raw = {'T1L2', 4; 'T8L9', 5; 'T1L2', 6}
raw =
'T1L2' [4]
'T8L9' [5]
'T1L2' [6]
>> rowId = strcmp( raw(:,1), 'T1L2' )
rowId =
1
0
1
>> data = cell2mat( raw(rowId, 2) )
data =
4
6

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!