how can I hold matrices in a container?

David Bateman dbateman at dbateman.org
Wed May 27 16:31:11 CDT 2009


Dr. Johannes Zellner wrote:
> Hi
>
> I'd like to do an operation like
>
>     [A, B, C] .* [x, y, z]
>
> fast! A, B, C are matrices, x, y, z are scalar.
> The result should be simply a row of the scaled matrices like this:
>
>     [A .* x, B .* y, C .* z]
>
> Apparently, holding [A, B, C] isn't possible.
>
> What's the recommended way to do this fast?
>
>   

 cellfun(@(x, y) x .* y, {A, B, C}, {x, y, z}, 'UniformOutput', false)


-- 
David Bateman                                dbateman at dbateman.org
35 rue Gambetta                              +33 1 46 04 02 18 (Home)
92100 Boulogne-Billancourt FRANCE            +33 6 72 01 06 33 (Mob)



More information about the Help-octave mailing list