4 ms·
MATLAB seems ill condusive for structuring and organising code in a sane manner. It tends to give its users bad habits with respect to structuring code is what
by billfruit 6y ago
MATLAB seems ill condusive for structuring and organising code in a sane manner. It tends to give its users bad habits with respect to structuring code is what I observe.
It seems to lack data structures that are quite pervasive in modern programming practise.
Also python being a general purpose system brings its own benefits, one can easily hook up ones code to fetch or push data to databases and even easily scrape data of the web or extract/reparse/rectify/reformat poorly/complexly structured data before processing.
And I find MATLAB not feature rich in terms of being able to manipulate tabular data in a relational DB like manner, that is querying/projecting/selecting rows/colums to find interesting facts.
- enriquto 6y agoOn the other hand, if all you need to do is to state and solve a few humongous linear systems, or a system of ordinary differential equations, or a partial differential equation, or compute the vibration modes of a solid shape, or perform an elasticity analysis, or simulate the absorption spectrum of a chemical compond, or find the numerical solution of a system of nonlinear equations, or optimize a function that has terms in both the spatial and the frequency domains, then Octave is definitely up to the task and will probably solve your problem out of the box in a handful of lines of code. In python/numpy, the sub-par linear solver will probably fail or be extremely slow on large linear systems (because the scipy developers are a bunch of anti-GPL fanatics that refuse to use the state of the art linear solvers because of license issues). But yes, you have nice strings and dictionaries at your fingertips; too bad they are completely useless for numerical computation.
- patrec 6y agoMatlab is much lower friction than python. You write a function, using nice linear algebra syntax. Already python is worse: you do a bit of import boilerplate and write linear algebra in a gimped notation. You call the function. Not so in python, where you have to import it first. You change the function definition, next call will be redefined function. In python you can try to do an interactive reload via third party software but chances are it won't work right since Guido apparently never considered this something worth designing properly (apart from matlab lots of "real" programming languages are much better at this, including erlang, common lisp and smalltalk). Your function runs too slow. You press a button and you see a color coded version of the code in your editor window and see instantly where the bottleneck is. In python you break out one of several crappy profilers. You want to save your results from your interactive exploration "save results.mat" -- done. In python there are various ways of saving stuff, which are either not general or slow or don't work between different versions. I haven't used matlab in years, but as an interactive environment for linear algebra it blew python out of the water and likely still does, even if it has a number of big shortcomings as a general purpose programming language (and probably a worse selection of libraries in quite a few numerical domains these days as well). This is particularly true if the people using it are not trained programmers.
- dragonwriter 6y ago> You call the function. Not so in python, where you have to import it first. Er, no you don't, if you are using it in the same notebook, module, or REPL session where you defined it. And if you aren't doing the equivalent in MATLAB, you also would have to load the definition.
- patrec 6y agoWhat on earth are you talking about? If I add `def bar...` to a file foo.py in my PYTHONPATH, it does not suddenly become available in my interactive session, I need to import it first. Further if I change foo.py even importing it again in the repl (or jupyter notebook) will not have any effect. You will need to use one of several reload hacks which in practice won't work reliably for all sorts of reasons. In contrast, unless my memory severely fails me (and I don't think so, since I just checked against octave), in matlab if you edit a file in the path, it will be auto-imported every time you save it as soon as the repl is non-busy. Have you actually used both matlab and python?