4 ms·
One of the nice things in Python is that it is nit limited to scientific computation. I remember the days when I tried to do command line automation in Matlab,
by Derbasti 13y ago
One of the nice things in Python is that it is nit limited to scientific computation.
I remember the days when I tried to do command line automation in Matlab, or tried to read some XML from some internet resource.
This stuff is super simple in Python, but very hard in Matlab, because Matlab focuses so much on science and so little on general usefulness.
Python is not as integrated with regards to the scientific core functionality, but it doesn't limit you to it, either.
- drunkpotato 13y agoMatlab leaves something to be desired for general programming tasks. If you can, it's sometimes nice to define stages and pipe between them. I love Python for text processing and XML, but I find Matlab way easier for shoving matrices around. I liked using the strengths of both by pre-processing raw text and XML files through a Python script, spitting out a CSV or tab-delimited file, and slurping that up in Matlab. Matlab has come a long way though. Coming from a functional programming background, I was delighted to find that you can pass functions as arguments to some matrix operators and get some very terse map+reduce operations.
- dagw 13y agoThere's Oct2py and mlabwrap which lets you call octave and matlab functions from python. I've used Oct2py a few times just like you describe and it worked fine. Read, parse and format my data in python, passing it to some matlab functions (which happend to work in octave) and then formatting and writing the results back in python.
- simonster 13y agoYes, for many things, Python is better than MATLAB. But the choice of language is no longer dichotomous, and Julia manages to be better for command line automation than Python. A pipe operator combined with custom interpolation for command literals gives you really beautiful syntax: fname = "/tmp/myfile with spaces" f = open(fname, "w") run(`echo hi` |> f) close(f) pipe, process = readsfrom(`cat $fname`) cmdoutput = readall(pipe) println(cmdoutput) I'd write all of my command line scripts in Julia, except the interpreter currently takes far too long to start. But people are working on that.