[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
cellfun
From: |
Juan Pablo Carbajal |
Subject: |
cellfun |
Date: |
Fri, 9 Dec 2011 19:01:45 +0100 |
Hi,
I want to index a given vector with a cell with logical arrays, the loop is
for i=1:numel (celltf)
indexedT{i} = T(celltf{i})
end
where T is a column vector of length nT and each element in the cell
celltf is a logical column vector of length nT.
I wanted to replace that with
indexedT = cellfun (@(ind_) T(ind_), celltf, 'UniformOutput', false)
For example
a = repmat ((1:10)',1,2);
c = {rand(10,1)>0.5, rand(10,1)>0.7};
cellfun ( @(x_)a(x_) , c,'UniformOutput', false);
but I get the error
error: can't perform indexing operations for matrix type.
Where am I making the wrong step?
Thanks
--
M. Sc. Juan Pablo Carbajal
-----
PhD Student
University of Zürich
http://ailab.ifi.uzh.ch/carbajal/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- cellfun,
Juan Pablo Carbajal <=