Hi,
You should have a look on tutorial material such as
http://www.scipy.org/Getting_Started
http://www.scipy.org/Tentative_NumPy_Tutorial
http://scipy-lectures.github.com/
You probably can find other pointers to tutorials suited to Matlab users.
Cheers,
JP Jadaud
> Message du 18/06/12 09:12
> De : "Bram"
> A : pyth...@googlegroups.com
> Copie à :
> Objet : [python(x,y)] Help with Arrays -- New User with MATLAB Background
>
>Hi all,I'm teaching myself the in's and out's of Python as I expect to use it by recoding my old MATLAB work into Python. Once I've got a handle on what I already can do in MATLAB then I plan to branch out and see how I can do more.
>
>I'm trying to fill an array inside a loop and it's telling me the name isn't defined. It works if I define the array with zeros first, but I'd rather just let it add values as it steps through the loop because I'll end up defining a bunch of variables. MATLAB has always warned me this is inefficient, but it significantly shortens the code and it's never gotten bogged down. Is there a way to make Python fill an array in a loop without having to set it first?
>In other words if I've read in data for a, b, and c so I can calculate v, the following works but not without the first line. I have a lot of calculations like this and I'd like to avoid a block of lines like the first one.
>v = zeros([3])for n in 0,1,2v[n] = a[n]*b[n]/c[n]
>Thanks.>
--
You received this message because you are subscribed to the Google Groups "python(x,y)" group.
To view this discussion on the web visit https://groups.google.com/d/msg/pythonxy/-/uxVgEZyeEyUJ.
To post to this group, send email to pyth...@googlegroups.com.
To unsubscribe from this group, send email to pythonxy+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pythonxy?hl=en.
Hi all,I'm teaching myself the in's and out's of Python as I expect to use it by recoding my old MATLAB work into Python. Once I've got a handle on what I already can do in MATLAB then I plan to branch out and see how I can do more.I'm trying to fill an array inside a loop and it's telling me the name isn't defined. It works if I define the array with zeros first, but I'd rather just let it add values as it steps through the loop because I'll end up defining a bunch of variables. MATLAB has always warned me this is inefficient, but it significantly shortens the code and it's never gotten bogged down. Is there a way to make Python fill an array in a loop without having to set it first?In other words if I've read in data for a, b, and c so I can calculate v, the following works but not without the first line. I have a lot of calculations like this and I'd like to avoid a block of lines like the first one.v = zeros([3])for n in 0,1,2v[n] = a[n]*b[n]/c[n]Thanks.