[SciPy-user] help finding Matlab equivalent

Trevis Crane t_crane at mrl.uiuc.edu
Fri May 18 16:40:37 EDT 2007


Hi,

 

In programming in Matlab, I often used expressions such as this:

 

a = 200:100:1000;

 

This gives

 

a = [200,300,400,...1000]

 

What's the best way to accomplish the same task with scipy/numpy?  I can
use linspace, but it's a little awkward.  For example, in order to get
the same value for a I have to do this:

 

import scipy

a = scipy.linspace(200,1000,(1000-200)/100 + 1)

 

Then,

 

a  = [200,300,400...1000]

 

Is there a more efficient/readable way to do this?

 

thanks,

trevis

 

________________________________________________

 

Trevis Crane

Postdoctoral Research Assoc.

Department of Physics

University of Ilinois

1110 W. Green St.

Urbana, IL 61801

 

p: 217-244-8652

f: 217-244-2278

e: tcrane at uiuc.edu

________________________________________________

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20070518/5b7be4fe/attachment.html>


More information about the SciPy-User mailing list