10 ms·
Matlab is oversold as a general-purpose language
- hayksaakian 13y agoAnd excel is oversold as a general purpose CRM
- batbomb 13y agoI'm surprised he's not railing against LabView and Origin too.
- rwg 13y agoRandom "LabVIEW isn't a general purpose programming language...except it kinda is" story: About a decade ago, my then-boss dragged me to a weeklong LabVIEW training course. The course was geared toward scientists and engineers (like my boss — I was sysadmin/programming/IT), and the instructor wanted people to bring data, problems, etc. from their own research to work on during the "hands-on" afternoons. I didn't have research, but I did notice that LabVIEW could open TCP sockets... By the end of the week, I had written a barebones graphical MUA (e-mail client) that could read mail via POP3 and send via SMTP. "Written" entirely in LabVIEW. (The "code" was spaghetti – tons of boxes of all sizes and a rats nest of wires connecting everything together.) The instructor asked for a copy to take back to NI, and I'd like to think that some NI engineers got a good laugh and/or vomit out of it.
- thelukester 13y agoYes, the cool thing about LV is allows you to turn an idea on a flow chart into code that resembles the original chart on the high level. And, nothing beats it for data acquisition and testing. Like all visual languages big projects and the finer implementation details can get ugly. Most people focus in LV's visual programming paradigm. But I think its real power come from the Flow Based Programming model. Functional programming is the trendy solution to the problem of concurrency these days. But I think FBP could offer some solutions in this domain too. NoFlo looks a promising new technology in this area. http://noflojs.org/ http://noflojs.org/
- spystath 13y agoI have written a bunch of programs for interfacing with instruments and when I started doing that I was using labview but it was such a pain. It was liberating when I found that VISA has python bindings. I now do all the instrument-interfacing code in Python+Qt. It is so much more productive that it makes me wonder why do people still want to use labview for this kind of job. I mean its visual language is complicated that it makes even the simplest things (like formatting a string) difficult. And on the top of that if you try to make something more complex the block diagram is completely unreadable. Madness.
- lbenes 13y agoIt all boils down to using the right tool for the job. If you need performance, C will blow python out of the water. If you need a quick solution that’s light on data acquisition and heavy on algorithms, python will probably be a better choice. I’ve run into a highly concurrent, signal processing tasks handled beautifully with LabVIEW and its built in SP modules. Python would have been a terrible choice for that application.
- psyklic 13y agoI also did psychophysics in Matlab. However, the author conveniently does not mention the wide variety of toolkits available for psychophysics in Matlab ... e.g. http://psychtoolbox.org/HomePage http://psychtoolbox.org/HomePage
- davyjones 13y agoMatlab was my first real programming language. I guess the real "power" of Matlab is the collection of toolboxes (which carry a separate price tag for each) and the graphing capabilities and built-in vector functions that are easy to use. I think it was conveniently entrenched because it was the cheaper than Mathematica(?), I can't be too sure but there weren't many alternatives with a similar set of features.
- mheathr 13y agoMathematica is a lot cheaper than Matlab, in the US anyways. Mathematica excels at symbolic computing, where as Matlab excels at numerical computing. Mathematica happens to be poor at numerical computing, and Matlab happens to be poor at symbolic computing, although Mathematica is becoming better at its current weakness at least.
- jackschultz 13y agoWow, that whole blog is focused on bashing Matlab. I find it a little difficult to trust a source that biased. If they can't find something good in a product that has been around for, according to wikipedia, something like 30 years, then that source shouldn't be trusted. I searched around to see if I could find something about the author but didn't see anything. Curious to see what their reasoning is.
- jordigh 13y agoThe author does acknowledge the good parts of Matlab right off the bat in his first post: https://abandonmatlab.wordpress.com/2009/07/23/hello-world/ https://abandonmatlab.wordpress.com/2009/07/23/hello-world/
- mturmon 13y agoIf this were better written and had a proper sense of proportion, it could be good. But it's not, and it comes off like ranting. Next. E.g., here's a note from the implementors of a probabilistic modeling toolkit, which prominently includes Kevin Murphy [http://code.google.com/p/pmtk3/wiki/WhyMatlab http://code.google.com/p/pmtk3/wiki/WhyMatlab] and here's a note from someone vacillating between several languages [http://jack-kelly.com/which_programming_language_for_my_disaggregation_system_matlab http://jack-kelly.com/which_programming_language_for_my_disa...], either of which shows more nuance and intelligence than the blog in the OP.
- krapht 13y agoFor something to be oversold... it has to be sold as something in the first place. I work at a company which uses Matlab extensively. I don't think anyone here views Matlab as a general-purpose language, even though you can put together some fairly fancy things in it. What we do view Matlab as is an exceptional domain-specific matrix manipulation and data visualization language. The IDE is exceptionally easy to use, and combined with the great graphs/plots makes debugging and iteration very easy. If we need to do something Matlab can't, we write it in a different language and use files for IPC. This approach covers 99.9% of everything we do. I get that Matlab is super expensive, and that annoys me too. I'd love to use it at home, and not struggle instead with terrible development environments(I use SciPy/Matplotlib at home - mostly from an IPython shell - Spyder doesn't cut it, even though I wanted it to so much). But my workplace pays real engineers and scientists fairly large sums of money, and doesn't bat too much of an eye at paying for productivity tools, the cost of which I feel is the main disadvantage of Matlab.
- rrrrtttt 13y agoI've been working with Matlab for years and have been quite intrigued by claims that SciPy is the new, better, Matlab. But every time I tried it, it felt like a cheap knockoff. For example, let's say I want to apply DCT to a matrix. In Matlab it's simply dct(A). How do you do that in Python? Well, there's scipy.fftpack.dct, but when I try it, it turns out it operates on the rows of A, instead of the columns. So I start searching the help, and find there's a parameter called "axis", with the useless description "Axis over which to compute the transform." So I try axis=1, axis=2, then finally axis=0, and presto, it works. So sure, it's functionally equivalent to Matlab, but do I really want to go through all this every time I want to accomplish a simple task?
- jurassic 13y agoSo, basically, you're panning the massive open collaborative effort behind SciPy/NumPy/Pandas because you can't be bothered to learn a slightly different and more flexible syntax? Because that's what it sounds like.
- 13y ago
- kyzyl 13y agoOkay, I'll bite on this one. I used matlab quite extensively (for years) in the medical imaging field, as well as other miscellaneous engineering (read: electronics, modeling, FEA. Not web apps) disciplines. I noticed several things about the matlab culture: - In academia, people really do not seem to give a fuck about using the right tool for the job. I used to try to explain to the people in my lab why their software was crashing, why it took four days to finish running, or why it would be easier to write new code than try to adapt the code written by the undergrad from 5 terms ago. About 70% of the time is was because the code had been written in the most naive way possible. The rest of the time it was because it was written is matlab. Seriously, it takes tremendous effort to write matlab code that doesn't suck. And even when you manage that, it's still crappier than if you'd used a proper programming language. So, yes, the author is right to rag on matlab as a language. But you know what? NOBODY CARES! The process goes: Carve off a problem, write some code, produce plot, publish paper, put figure-indicative-of-progress into grant renewal application. The people in charge don't care if twelve undergrads lost their eyesight debugging the code, and it stops working if the lab door is shut too loudly. - I learned that if I just wrote my software in the proper language, in the proper way, and didn't tell anybody I was doing it that way, everything worked out extremely well. The above cycle was allowed to complete, the people in charge usually didn't even ask, and in a month when they asked me to adapt my work to include the marvelous thing the ultrasound lab had come up with I could just say "Okay!" without wondering if matlab would inexplicably fall on its face when I was 90% through the development. - Even if you manage to get a conversation about choice of tools going, most of the people present will nod and pretend to be interested, but won't change anything at all. The people who will "see the light" and make an active attempt to improve their understanding are generally the ones who would have done it on their own eventually. (side note: I did successfully--and accidentally--convert a large sect of the physics department to python, and it's all they use now. They even started using proper SCM!) - When working with matlab, I always had my best results when I did two things. First, keep the approach to coding as simple as possible. Don't try to make things too generic, don't try to make the code too fault tolerant, don't try to implement STM. Second, use the built-in shit! There's a toolbox for that? Use it, ship it. The idiomatic way to do something makes you ashamed to operate a keyboard? Do it anyway (usually). In other words, don't fight it, because you will never get what you want. That doesn't mean don't do any error checking. That doesn't mean blindly use libraries that give you the wrong answer. But overall I found the path of least resistance produced my highest productivity with matlab. - Sometimes, matlab is actually kind of okay. I can still fit a univariate curve faster in matlab than I can in python, excel, gnuplot, or mathematica. I think R still probably has the most concise syntax for this task. Learn to understand the niche areas where matlab shines, and take advantage of that. - As soon as the default performance of matlab is not good enough (i.e. profiling your code shows no obviously large improvements available), either change approaches, make your problem smaller, or stop using matlab. There are lots of options for improving the performance of matlab code: distributed computing toolbox, mex files (calling to C), proprietary optimizers/compilers like Jacket, contorting your problem to fit matlab's memory layout... it goes on. However, I've found every one of them to be more trouble than it's worth. - Matlab is not a general purpose programming language. Know that, and be free.
- Rickasaurus 13y agoAs someone for who matlab was his 5th or 6th language, I can say it's frustratingly opaque. Even once you have a good feel for how the linear algebra works, you find yourself struggling for hours to transform a simple cell array into the format you'd like. I deeply hope that when Julia matures it puts matlab into its grave.
- sillysaurus 13y agoMathematica, on the other hand, is brilliant. It's a wonderful language with wonderful libraries and functionality, and it's quite clear how to write robust code in it.
- nkurz 13y agoI'm not familiar with your commenting style. Is this straight up or dripping with sarcasm?
- sillysaurus 13y agoSerious. Super serious. No, really, Mathematica is great. It can do some amazing things and it's really easy to write reusable code for.
- zzleeper 13y agoWhat advice or pointers would you give to start learning & using mma for real problems? I tried to learn it a few times and it worked great for toy problems, but when I tried to write an entire script a la python/c/matlab, I failed miserably
- xrt 13y agoMy favorite example. The chosen answer to the "Where's Waldo?" solution is 7 lines long. http://stackoverflow.com/questions/8479058/how-do-i-find-waldo-with-mathematica http://stackoverflow.com/questions/8479058/how-do-i-find-wal...
- maurits 13y agoThe solution is basically a cross correlation in a colour channel between the image and a zebra pattern. That can be done in a few lines in more than one language. Also, 7 lines is hardly a good metric to judge the general effectiveness of an environment or language.
- mheathr 13y ago
- pachydermic 13y agoHere's what MathWork's website says: ---------------------------------------------------------- MATLAB® is a high-level language and interactive environment for numerical computation, visualization, and programming. Using MATLAB, you can analyze data, develop algorithms, and create models and applications. The language, tools, and built-in math functions enable you to explore multiple approaches and reach a solution faster than with spreadsheets or traditional programming languages, such as C/C++ or Java™. You can use MATLAB for a range of applications, including signal processing and communications, image and video processing, control systems, test and measurement, computational finance, and computational biology. More than a million engineers and scientists in industry and academia use MATLAB, the language of technical computing. ---------------------------------------------------------- I work at a place where people use (and abuse) MATLAB a lot. The thing is, they're not programmers. As smart as they are (and they are truly brilliant) they're not especially good with computers, programming or computer science. If they tried to use a 'real' programming language, things would undoubtedly be even worse! MATLAB is awesome at giving you powerful functions baked right in. That's good because people who aren't good at coding efficiently don't have to. Instead of messing up the whole program from start to finish, they only mess up the top level and that often isn't as big of a deal as messing up the small components that get used again and again and have to be as efficient as possible. I agree that MATLAB isn't a general purpose programming language, but I don't think that that's how MathWorks is really selling it (note that "[creating] applications" is at the end of the list and analyzing data is at the beginning). They're mainly saying it's good for solving a specific group of problems - those that technically minded people (like scientists, engineers, economists and financial analysts) have to solve. I actually agree, especially when you take into consideration the fact that the people who really like MATLAB the most aren't really into programming or even that good at it. Of course that's just my opinion. I'd like to hear how you guys disagree with me.
- kyzyl 13y agoI'm curious... is the matlabbing that happens at your work related to the simulink/realtime/control parts of matlab? Based on the other things you've said it sounds to me like that might be the case. Obviously I might be wrong. In any case, I've found that those parts of matlab can actually be used pretty effectively. I think the reason is that, even though matlab as a language is pretty crappy (IMO), these domains aren't actually dominated by programming languages. Take for example industrial control. It's extremely common to use PLC's, PAC's or FPGAs. These tools are, like simulink, largely operated via proprietary graphical environments. Essentially, I agree with your points for uses of matlab where you don't write much custom code, and/or where your custom code is very insulated from the 'real world' and even from the rest of the system.
- jurassic 13y agoThe author is totally biased, but that doesn't mean he is wrong. If the bias offends you, you aren't the target audience. I personally have experienced several of the things he rants about, so I know his pain and now as a policy refuse to produce additional IP in that ecosystem. When friends ask me for help, I now send them a python script. The rage doesn't really come from MATLAB (every language has warts); the rage comes from being forced by the social conditions of the academic workplace to collaborate on problems with totally inappropriate tools. Nobody wants to hear about how you've been procrastinating with python or git... they just want to push some new parameters into the lab's creaky matlab model and publish a new paper. Anybody who---as the lab's "code guy"---has been handed a disk full of broken, undocumented Matlab code that mysteriously no longer works after the latest update knows what I'm talking about.
- pachydermic 13y agoI have seen some horrible shit. Terrible, awful, fucked up stupid undocumented code. I have worked in psychophysics shops (go figure). What makes you think it would be any better had they not used MATLAB? I actually like MATLAB. It really excels when used as a glorified calculator and you can plug lots of things into it and have it 'just work' without much fuss. When I worked in a tutoring lab sometimes it was cool to have around because I could quickly whip up something interesting and visualize the whole thing to explain concepts. When I worked in the research lab (after I completely trashed the old application and started my own) I could hook up the computer to some cool hardware, run the experiment and do the statistical analysis all in one place. At my job now, people who aren't good at programming can use a computer to solve very hard problems. I don't know why it's getting so much hate. I agree that it's not a good tool for every problem and that in the scientific community (and especially the psychology community) it is overused. But I don't really see why switching to another language would make things better.
- jurassic 13y ago> What makes you think it would be any better had they not used MATLAB? Probably the most general cross-disciplinary reason MATLAB worsens an already bad situation is that it isolates scientists and engineers from people who are good at programming. When you seek out help for a particular problem, it's often a blind-leading-the-blind situation. How can you learn to program well if you've never seen a good piece of MATLAB code? Good luck finding good examples and role models to learn from if your programming universe is limited to MATLAB. Poor quality and practices proliferate because there is almost never anyone skilled reviewing changes and helping you get better. People just make a change and pray it still works.
- LordHumungous 13y agoR for life.
- nonchalance 13y agoFrom the article: > The first problem is that the MathWorks actively markets MATLAB as a “general purpose programming language” with all the trappings, something which it is manifestly not. From MATLAB site http://www.mathworks.com/products/matlab/ http://www.mathworks.com/products/matlab/ : > MATLAB® is a high-level language and interactive environment for numerical computation, visualization, and programming. "high-level" != "general-purpose". The author grossly misrepresents Mathworks' stance regarding MATLAB
- mgkimsal 13y agoTo be fair, what their website says and what their sales people might be saying in the field could be two different things.
- Ironballs 13y agoThis is the reason why people should migrate to general purpose languages that can also be used for computation, such as Python and pandas (Python data analysis library, http://pandas.pydata.org/ http://pandas.pydata.org/), or languages that are modern and have been designed for such a purpose, like Julia (http://julialang.org/ http://julialang.org/).
- utopkara 13y ago1) Matlab is awesome for scientific computing and simulations. 2) Many Matlab users don't write any code but scientific code. They couldn't care less about how flexible python (or other language) is, when they already use and know Matlab. 3) Matlab doesn't make money from colleges or grad schools, they make money from industry customers. Of course the engineers and scientists of those deep pockets get trained at colleges and grad schools. 4) If you can write python, c++, or javascript, and if you keep publishing scientific code in that language even when Matlab is better suited, then it is possible that others will come with you. I am rooting for you. Just so you know, depending on the field, if you published your code in Matlab or R or whatever is the most popular for the field, you'd probably get more citations. Since academia is rounding error in Matlab's income, you will only be hurting yourself, if you chose not to use Matlab in a problem that it is best suited for. 5) Projects fail for many reasons. But, in your case, could the common denominator be the university rather than Matlab? In universities, it is hard (and I'd say unethical) to keep students for very long, so a research group may end up with a lot of code without owners if they are not careful. Good labs manage their projects, codebase, and hand-offs better.
- mgraczyk 13y agoMATLAB is a tool that is unmatched in algorithm design. It isn't C, it isn't python, and it certainly isn't Linux. If you happen to work in an industry where you actually do math at your job, then you should probably use MATLAB. Otherwise, just don't use it and stop complaining. Things for which MATLAB is not good: -Systems programming -Web programming -Scalable business logic programming Things for which MATLAB is good: -Robust simulations -Computationally intensive desktop applications -Any computationally complex tool or utility -Mathematical data processing Things for which MATLAB is the absolute best tool available: -Design and rapid prototyping of DSP and GPU bound algorithms. -Windows desktop calculator for engineers -Prototyping communications system (Labview maybe better for very complex systems, but certainly not simple ones) -Design of financial, image processing, communications, signal processing, or control systems algorithms.
- joelbondurant 13y agoMatlab encourages not distinguishing the very distinctly different concepts of matrices, vectors, scalars, and arrays.
- RivieraKid 13y agoWhat about Julia? Is it a general purpose language?
- zem 13y agoIt is. It may focus on a specific ecosystem, but the underlying language has been thought through properly as a language.
- santialbo 13y agoJulia seems like an easy transition for any Matlab programmer. The syntax is very similar and the built-in package manager makes finding new libraries way easier. And apart from that, performance is awesome. If having an IDE is an issue, Julia also has one (http://forio.com/julia/index http://forio.com/julia/index) which looks a lot like Matlab.
- lelf 13y agoIt's strange there're no single comment about Octave — http://www.gnu.org/software/octave/ http://www.gnu.org/software/octave/ It's free software and the language is 99% compatible with Matlab. Edit: and yes, Matlab is not intended for any generalisation/abstraction. It's a big scientific calculator with REPL. And complicated program in it still feels like big calculator
- deleted 13y ago[deleted]
- Derbasti 13y agoAnd it shares all of its weaknesses. So why bother when there are alternatives like Python or R available?
- jordigh 13y agoNot all of them. Some of the most annoying things about the Matlab language we attempt to fix, as long as we can still run existing Matlab code. For example, you can index temporaries in Octave: x = sin([1, 2,3])(2). A few more things here: http://wiki.octave.org/FAQ#What_features_are_unique_to_Octave.3F http://wiki.octave.org/FAQ#What_features_are_unique_to_Octav...
- ErsatzVerkehr 13y agoAs someone who loves Matlab but would rather use a free-software solution, I must say that Octave is not an effective replacement for Matlab. Matlab itself is just so much more feature-complete and polished, turning to Octave feels like going back two decades in technology.
- mheathr 13y agoIn what way is Matlab more feature-complete and polished? With respect to just the actual language Octave is nearly a 1:1 implementation of Matlab, which is an primary goal to stride for and maintain, any differences between the two is considered a bug even.
- ghsalazar 13y agoParaphrasing the Greenspun's tenth rule of programming: "Any sufficiently complicated C or Fortran numerical program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of MATLAB/Octave/Scilab." This could be called Gastón's corollary :-). MATLAB, Octave and Scilab are like the UNIX shell but for matrices instead of text streams; this is they problem domain. If you can explain a problem with matrices and their operations, you can profit from MATLAB/Octave/Scilab. If you need more speed from your program, you should profile it and develop a mex-function in C or Fortran. In academia and engineering most programs are developed to run at most thousands of times (<10,000), and this statement could be greatly exaggerated; the developing time must be reduced in order to work in other projects. The usual approach is brute force. The greatest problem that I find with MATLAB is that doesn't allow multiprocessing. In my last project, I ended developing several interpreters in Bison/Flex/C that ran concurrently in order to control a robot, but the main program was developed in MATLAB because it was simpler that way.
- PeterisP 13y agoIn academia I'd say most programs are run (when finished) 2-3 times - once on a smallish testset when you decide that this version is correct, second time on the full data that you have to produce results for the paper (and you don't care how long it runs as long as it finishes before the submission date); and maybe a third time if you get a larger/better dataset somehow.
- ghsalazar 13y agoIt's sad, but you're right. In my field, I've found that there is little interest in experiment design when doing data analysis; you'd be asked to perform an analysis on eight or ten data sets, only because the people think that is exhaustive.
- slacka 13y agoMatlab is just another tool for your toolbox. Part of programming is choosing the right tool. I found Matlab extremely useful in college for graphing my lab work. Haven't had much use for it since. Did run across OpenTLD AKA predator. It's is a sweet CV app that is primarily written in matlab. https://github.com/zk00006/OpenTLD https://github.com/zk00006/OpenTLD
- analog31 13y agoIn a crowded market, the sales pitch has to anticipate and overcome "negatives." Thus, MATLAB has to be marketed as a "real programming language" to overcome the fear that it will prove inadequate for some task in the future -- especially when you had to beg and plead for the money to buy a license. And amateurs (including me) don't always see the difference between the language and the libraries, so the demand for a "real programming language" results in a huge bloated product festooned with every possible bell and whistle. I wouldn't have a problem with a tool that falls short of completeness (Turing- or otherwise) if it's simple and does something useful for me. I love spreadsheets.
- kazagistar 13y agoIs there a "Matlab: The good bits" guide out there somewhere? I think a style preference guide, made by an experienced programmer who worked on large matlab codebases would be valuable both for programmers who have to figure out how to work reasonably with Matlab, and the scientists and mathematicians who just don't know any better.
- skierscott 13y agoMatlab is useful for it's special use case -- for mathematical applications (signal processing, medical imaging, etc). It has good tools to speed up the code too: parfor and the like. But the cost gets to me. It inhibits collaboration, and costs a ton for non-academics. From scientific computing[1]: > $1,900 for the commercial Matlab; $2,800 for Simulink; and typically $800 for each toolbox. The whole Matlab suite doesn't sit well with me, so I'm most likely a Pythonista. The speed of Numpy/Scipy is comparable, and the quality of the Matplotlib plots wonderful. In fact, I've done a speed comparison[2] between between Python and Matlab. I would have optimized more in Matlab, but didn't have access to the Optimization toolbox. [1]:http://www.scientific-computing.com/review1.html http://www.scientific-computing.com/review1.html [2]:http://nbviewer.ipython.org/urls/raw.github.com/scottsievert/side-projects/master/matlab_vs_python/Python%2520vs%2520Numba%2520vs%2520Matlab%2520vs%2520C.ipynb http://nbviewer.ipython.org/urls/raw.github.com/scottsievert...