vectorisation and cell arrays

Ben Abbott bpabbott at mac.com
Fri Mar 27 06:36:57 CDT 2009


On Mar 27, 2009, at 7:32 AM, Bertrand Roessli wrote:

> Hello,
>
> Does anybody know if it is possible to vectorize
> matrix operations (the matrices are stored in a cell array)
> on a vector and so to avoid looping over the elements
> of the cell? Thanks in advance
>
> For example
>
> a =
>
> {
>  [1,1] =
>
>     1   0   0
>     0  -1   0
>     0   0   1
>
>  [1,2] =
>
>     1   0   0
>    -1   0   0
>     0   0  -1
>
> e=[1;2;3];
>
> a{1}*e
>
> ans =
>
>   1
>  -1
>  -3
> works fine, but
> a{:}*e
>
> error: binary operator `*' not implemented for `cs-list' by `matrix'
> operations

Take a look at cellfun

	help cellfun

	doc cellfun

Ben




More information about the Help-octave mailing list