I have a cell array, something like this:
A =
'5523' '2012-10-26' '23' 'T' '17.7'
'5513' '2012-10-26' '23' 'T' '22.1'
'5506' '2012-10-26' '23' 'C' '16.2'
Now I would like to filter all records that have T. So I would like to get this array:
A =
'5523' '2012-10-26' '23' 'T' '17.7'
'5513' '2012-10-26' '23' 'T' '22.1'
I could parse all array, but is there any other way?
Here’s a one-liner to do it:
The inner part,
strcmp(A(:,4), 'T'), is comparing column 4 of all rows to'T'. Then that boolean vector can extract matching rows fromAwith logical indexing.