|
Ugo:
Here is an example on how to extract specific probsetIDs:
Variable d is a DataMatrix
>> d =
Sample1 Sample2 Sample3 Sample4
Feature1 71 72 73 74
Feature2 81 82 83 84
Feature3 91 92 93 94
Feature4 101 142 143 144
Feature5 151 152 153 154
To subset with row names and column names:
>> d({'Feature1', 'Feature4'},{'Sample1', 'Sample3'})
ans =
Sample1 Sample3
Feature1 71 73
Feature4 101 143
To extract only the values of a subset with row names and column names:
>> d.({'Feature1', 'Feature4'})({'Sample1', 'Sample3'})
ans =
71 73
101 143
Or
>>rowIdx ={'Feature1', 'Feature4'};
>> colIdx ={'Sample2', 'Sample4'};
>> d(rowIdx,colIdx)
ans =
Sample2 Sample4
Feature1 72 74
Feature4 142 144
>> d.(rowIdx)(colIdx)
ans =
72 74
142 144
The indexing can be a numeric or logical vector like other MATLAB arrays, or cell arrays of strings for indexing.
One more thing, the colon operator should work also:
>> d(rowIdx, :)
ans =
Sample1 Sample2 Sample3 Sample4
Feature1 71 72 73 74
Feature4 101 142 143 144
>> d.(rowIdx)(':') %Colon is in single quote – ‘:’
ans =
71 72 73 74
101 142 143 144
Let me know if this solves your question.
Lucio
"Ugo " <borello.ugo@ijm.jussieu.fr> wrote in message <gnm6q9$s6v$1@fred.mathworks.com>...
> Dear all,
> I created a DataMatrix Object with my microarray data. I am trying to find a subset (~2000) of all the probesetIDs on the DataMatrix Object. I have the probesetIDs I am interested in a cell variable. It is easy for me (consider I am a biologist!) to work with 2 cells but how can I extract specific probsetIDs, and their values, from a DataMatrix Object?
> Thank you for your help
>
> Ugo
|