--
You received this message because you are subscribed to the Google Groups "spyder" group.
To post to this group, send email to spyd...@googlegroups.com.
To unsubscribe from this group, send email to spyderlib+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spyderlib?hl=en.
Just for reference this is the Matworks help page describing the display
block in Simulink:
http://www.mathworks.com/help/toolbox/simulink/slref/display.html
and this is the page describing the scope block which draw a graph of
the variable at runtime:
http://www.mathworks.com/help/toolbox/simulink/slref/scope.html
Il 08/06/2011 15:06, David Verelst ha scritto:
> Hi,
>
> First of all, I am not a Simulink user so I do not know exactly what
> kind of functionality you are referring to. As far as I know, however,
> there is no real open source alternative to the power of Simulink. You
> will not be able to use spyder as you use Simulink now. It will require
> a quite different working approach.
>
> You can save any variable at any moment in your script. For instance,
> you can use pickle (python build in function), numpy.save or pytables
> (depending on what data you need to save) to save whatever variables you
> want to the hard disk. This will not give you right away a variable
> history, but if you tweak around your saving algorithm I guess it could
> be made in such a way. Note that I am not an expert, maybe this is just
> a silly suggestion for your application.
>
> I have no experience with graphical programming with python, but I think
> it shouldn't be too hard to create some graphical application with Qt
> which simply prints out some variables. There are plenty of tutorials
> around which will point you in the right direction. Some random picks
> from google:
> http://www.wellho.net/mouth/2746_Model-View-Controller-demo-Sqlite-Python-3-Qt4.html
> http://sector.ynet.sk/qt4-tutorial/my-first-qt-gui-application.html
>
> Hope this helps,
>
> David
>
> On 7 June 2011 22:59, Andrea Amorosi <andrea.a...@gmail.com
> <mailto:andrea.a...@gmail.com>> wrote:
>
> Hi to all,
> I'm a matlab/simulink user and I'm searching to use python with Spyder
> as an alternative to create dynamic models.
> I would like to know how to save variables history (data at each
> execution step) in variable workspace. Should I define the variable
> global? Moreover I would like to know if it is possible to connect a
> variable in the model to a graphical display or scope simular to the
> ones available in simulink.
> Thank you,
> Andrea
>
> --
> You received this message because you are subscribed to the Google
> Groups "spyder" group.
> To post to this group, send email to spyd...@googlegroups.com
> <mailto:spyd...@googlegroups.com>.
> To unsubscribe from this group, send email to
> spyderlib+...@googlegroups.com
> <mailto:spyderlib%2Bunsu...@googlegroups.com>.
Coming back to your questions:
1) the possibility to read/write data in the workspace from a script
The scope of variables in Python depends on the context. A script can
have global variables (accessible for al including classes and
functions) but they will not be available by default inside modules
you load from elsewhere, unless you pass the variables on of course.
Note that you can always pass on variables to whatever function or
class you load, whether they are living inside your script or not.
There are many good books available about how to deal with python in a
scientific context and which will also explain how to deal with the
scope of and life time of your variables. I strongly recommend to take
some time to go through them. On a personal note I can tell you that I
would have saved myself a lot of misery if only I would have invested
the time in reading a good book (or taking a course for that matter)
about Python!
Some course suggestions:
* Python Scientific Lecture Notes
http://scipy-lectures.github.com/
* 6.189 A Gentle Introduction to Programming Using Python
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-189-a-gentle-introduction-to-programming-using-python-january-iap-2008/
A book suggestion:
* Python Scripting for Computational Science (3th edition 2008)
http://www.springerlink.com/content/978-3-540-73915-9
http://www.springer.com/mathematics/numerical+and+computational+mathematics/book/978-3-540-73915-9
2) I don't have any experience with visualising variables during
runtime other than including print statements now and then to see if
all is going well. I suppose there are more intelligent ways of doing
that, but I personally never pursued, interesting as it is, the idea
myself. A short googling on "visualize data runtime python" and
derivatives learns me there is no dead simple answer available. I
would also like to refer you to the topical software list on scipy:
http://www.scipy.org/Topical_Software, which gives an (incomplete) but
extensive overview of python modules relevant in the scientific
context. Than there is also the Python Package Index:
http://pypi.python.org/pypi for an even more extensive and general
list.
So, in conclusion, I suggest you to take some time to dive into python
and, to my knowledge, problem nr 2 is not straight forward to solve
(back to suggestion 1).
Regards,
David
On 8 June 2011 23:12, Andrea.A...@gmail.com
It improved quite a lot in the last year. It has not as many libraries
as Simulink, but you
can do a lot of modeling with the included modelica block.
Best regards:
Uwe Fechner