I have a Matrix A =
'30' 'X' '@NA'
'15' 'Y' [231.001]
'00' 'Y' [21.110]
'20' 'W' '@NA'
'55' 'X' [9.001]
'10' 'X' [11.211]
>>whos A
Name Size Bytes Class Attributes
aaa 6x3 226 cell
How can I get a new matrix B that delete the whole row of Matrix A if there is anything other than '10','15','20'...'55' in Column 1, or any '@NA' in Column 3 , and MERGE the next qualified row.
Take A for example, Row 1 and 4 should be deleted because there is '@NA' in Column 3. Row 3 should also be deleted because there is '00' in Column 1.
Matrix B should like,
>>B
B =
'15' 'Y' [231.001]
'55' 'X' [9.001]
'10' 'X' [11.211]
B is a 3*3 cell matrix.
Any suggestion is welcome!
In your example, you don't say what you mean by "merging the next qualified row". All you are doing is selecting rows that fail on one criteria or another, and deleting them. If that's actually all you want to do, then something like this would be okay:
validnums = arrayfun( @num2str, 10:5:55, 'uni', 0 );
column1valid = ismember( A(:,1), validnums );
column3valid = cellfun( @isnumeric, A(:,3) )
B = A( column1valid & column3valid, : );