Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You don't have to use .* and friends when operating in 2 scalers, 2 * 3 works just fine. But if you have 2 matrices A and B, A * B does a matrix multiplication, And A .* B is needed for element wise multiplication.

I'm still new to matlab, but the place where this has bitten me is if I'm trying to write code that works on either a scalar or vector of scAlars, if you aren't specific, the code my run fine against a single scalar, but blow up or do the wrong thing with a vector.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: