Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: help with DataMatrix objects
Date: Fri, 20 Feb 2009 14:11:03 +0000 (UTC)
Organization: The MathWorks Inc
Lines: 78
Message-ID: <gnmdln$s91$1@fred.mathworks.com>
References: <gnm6q9$s6v$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1235139063 28961 172.30.248.38 (20 Feb 2009 14:11:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 20 Feb 2009 14:11:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 222043
Xref: news.mathworks.com comp.soft-sys.matlab:519689


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 &#8211; &#8216;:&#8217;

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