octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bsxfun for arrays


From: Jordi Gutiérrez Hermoso
Subject: bsxfun for arrays
Date: Fri, 13 May 2011 20:01:11 -0500

While working on #33292, I came across a behaviour of bsxfun I don't understand:

     x = rand(1,1,3); y= rand(2,2,3); u = bsxfun(@(t) t, x,y); sum(u(2,:))

That above outputs zero at changeset b6eaecf83bb2 because all of
u(2,:) is zero. I don't get it. Why wasn't the "vertical vector" x
copied four times?

I had someone try this in Matlab, and they reported that it errored
out with  "Error using ==> bsxfun: Invalid output dimensions" which I
find even more mystifying. Who specified anything about output
dimensions?

TIA,
- Jordi G. H.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]