[SciPy-User] Efficient replacement to matlab textscan

josef.pktd@gmai... josef.pktd@gmai...
Wed Oct 5 21:06:26 CDT 2011

On Wed, Oct 5, 2011 at 9:57 PM, Tim Pitman <tapitman11@gmail.com> wrote:
> Hi All,
> I'm working on a project which currently uses matlab to generate a
> real time plot which uses textscan
> (http://www.mathworks.com/help/techdoc/ref/textscan.html) to read a
> file with about 800 float values (all in one column but each on it's
> own line) every other point is the x value and the off values are the
> y values, totaling about 400 points. The function then plots all the
> points. This is done about 10 times per second providing a constantly
> updating graph. Matlab uses about 9% CPU when this is running. I'm
> trying to replace this with numpy/matplotlib in a wxPython app. My
> wxPython app runs at about 20% CPU without the plot running but once I
> start the plot at 10 updates per second CPU usage jumps up to %70
> percent. I'm currently using genfromtxt to read the file. I'm looking
> for suggestions on how to optimize this as much as possible.

numpy.loadtxt and reshape ?

genfromtxt tries to do a lot of inference about the file


> Thanks!
> Tim
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user

More information about the SciPy-User mailing list