0

I'm looking for a range of rows containing a string 'chr1' in sorted cell array rawArrayData.textdata so that I can work with just the data in those rows (e.g. just coordinates on a given chromosome, chr1):

chromCols = find([rawArrayData.textdata{:,1}] == 'chr1'); Error using == Matrix dimensions must agree.

I presume the error is improper use of find. Is there a way to do this with cell arrays? Alternately, is there a way to convert instances of 'chrX' to X, convert that to a double and use find?

I used this answer as a starting point, if that helps.

I'm pretty new to this stuff - if there's any other info I can provide I will do so.

Thanks a lot.

1
  • Can you provide example content of rawArrayData.textdata? Commented Feb 25, 2014 at 3:53

1 Answer 1

1

If your rawArrayData.textdata is as below, you can do something like that:

rawArrayData.textdata = {'chr4'; 'chr1'; 'chr2'; 'chr1' };

chromCols = find(cellfun(@(s) strcmp(s, 'chr1') == 1, ...
                    rawArrayData.textdata));

% chromCols = [2, 4]    

% get only chromCols rows
rawArrayData.textdata{chromCols, 1}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.