[SciPy-Dev] [Wiki] NumPy / Matlab-Cheatsheet

Juan Luis Cano juanlu001 at gmail.com
Tue Nov 25 05:28:56 EST 2014


+1
On Nov 25, 2014 10:30 AM, "Todd" <toddrjen at gmail.com> wrote:

>
> On Nov 25, 2014 9:30 AM, "Michael Käppler" <xmichael-k at web.de> wrote:
> >
> > Hi guys,
> > thanks for this great cheatsheet you provided on
> > wiki.scipy.org/NumPy_for_Matlab_Users.
> > I'm not allowed to edit the wiki, so I would like to propose an addition
> > regarding different array shaping conventions: Consider f.e. a Matlab
> > zeros(1, 4).
> > If I'm right, this results in a [0 0 0 0] or in something that Matlab
> > treats like a 1D-Array if it makes sense. You can f.e. do
> > diag(ones(1, 4)) and you get a matrix.
> > However, NumPy zeros((1,4)) results in [[0 0 0 0]], which is 2D and if
> you
> > try to do diag(ones((1,4))) you will get [1], which is obviously
> different
> > behaviour compared to Matlab.
> > NumPy zeros(4) yields [0 0 0 0] which seems to me is the correct
> > equivalent. Other Matlab commands that use this array shaping syntax are
> > also affected in the same way.
> > I recently ran into this issue while porting some Matlab code to NumPy.
> >
> > Have a nice week,
> > Michael
>
> Is this something that might be moved to github so it would be easier to
> submit changes?
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20141125/6f0cb14c/attachment.html>


More information about the SciPy-Dev mailing list