About
This blog is all about why you should not use MATLAB. I’m stating it as plainly as I can: Unless you have no other alternative, you are better off picking something other than MATLAB for your scientific programming needs. And there is always an alternative.
I feel about MATLAB pretty much the same way Steve Yegge feels about Perl. The parallels are numerous and uncanny.
Jim said,
September 13, 2011 at 12:51 am
Hi,
Here’s a bit of matlab output that may surprise you.
>> x
x =
100
>> y = 400;
>> z = x + y
z =
127
You’ve probably guessed what is happening. x was defined as type int8 and has caused z to be cast down to int8. Does any other language do this sort of thing? Is this a well known feature of matlab?
Feel free to invent much more complicated examples. I spent days trying to debug my code before I did a “whos” that showed that I had a very large collection of int16 values. It was all caused by one int16 scalar that resulted in lots of derived numbers becoming int16.
crowding said,
January 11, 2012 at 3:56 pm
Yeah, MATLAB’s numeric type hierarchy is completely backwards, every operation with two types is cast to the less accurate type as result. It’s completely the inverse of what every other language does. I kept trying to write a post detailing this but kept boggling — how do you explain that a tool has been constructed, not merely without forethought, but with malice aforethought? That the designers of the language sat down, considered the options, and chose the WORST POSSIBLE of all possible ways to do things?
Aurélien said,
April 20, 2012 at 1:36 am
whos is one of the first command that you learn as a MATLAB beginner. I am surprised that you didn’t understand the “127″ behavior whereas you know the int16 or int8 command. It is definitely a great feature to save memory when you know the type of data that you are using.
crowding said,
April 20, 2012 at 2:12 pm
The original reason integer data types were introduced in MATLAB was to save memory for signal processing or image processing functions. This is why they chose the weird saturating-add behavior. But if you look at signal processing or image processing toolboxes do today, you’ll see that they all insist on using doubles. This is because MATLAB’s broken backwards numeric type hierarchy caused more problems for users than it ever solved.
In reality, the only function of saturating arithmetic is to disguise overflows. If you actually give two whits about your data, arithmetic overflows ought to raise red flags all over the place. What MATLAB does is make its mistakes as silent and invisible as possible. Data in, garbage out.
Sometimes it it useful to restrict the range of a type in order to save memory. Most languages let you do this sensibly. Hell, even C and Fortran will do it sensibly. MATLAB’s approach is worse than useless and causes nothing but problems.
sifta said,
August 24, 2012 at 1:22 pm
Man… Your 4 year and counting rant-fest is totally awesome, and cathartic. I could overlook some of the flaws, but when you get in there and see the lipstick on the pig, it is a big demotivator.
Rock on, brother!
Yuval Tassa said,
August 30, 2012 at 8:12 pm
I agree with everything here. My two cents (Under ‘rant’, feel free to quote/link):
http://www.cs.washington.edu/homes/tassa/mmx/mmx_web.html#26
per isakson said,
February 10, 2013 at 1:11 pm
No new argument to abandon MATLAB in one and a half year ?
crowding said,
February 20, 2013 at 3:21 am
August 2012 – Feb 2013 is how long?
BTW, Dijkstra long ago observed that people writing in a language where indices start at 1 are far more prone to off-by-one errors.
Ziba Z. said,
February 19, 2013 at 11:13 pm
matlab is all that is needed for any scientific work. all the bad stuff comes from comp sci majors hired in the last 5 or so years trying to forcefeed the stupidity that comp science is. The author of matlab has created a perfect language in its original philosophy for scientific needs. The other half of stupidity is other comp sci majors talking about unimportant comp-sci-related stuff that other comp-sci ‘dont-know-betters’ hired at mathworks have relatively recently implemented. We don’t need your ‘strvcat is obsolete, consider …whatever’ crap. We don’t need useless ‘methods, classes, structures’ and similar useless bs that could come only from a comp-sci major. We need a math oriented language, which precisely what original matlab is/was. I don’t see much past v4 as an improvement in terms of language (code optimization aside) – if anything else, it is spiraling backwards thanks to the well recognized influence of comp-sci majors infiltrating the genius language for scientific needs. Of all of them, the function handles syntax is probably the worst case example of things going wrong.
Ziba Z. said,
February 19, 2013 at 11:26 pm
And forgot to say, you must be a comp sci or related major. funny that you mention ‘scientific needs’ in your ‘about. if you had any ‘scientific needs’ other than comp ”sci” (should be called comp uncompetent individuals failing at any real ”sci” picking up comp as their major and trying to make it sound more credible thereby calling it ”sci”), we would not be seeing this bunch of useless crap, but rather a vent at comp ”sci” people mathworks have hired in the recent past. So please call yourself what you are, comp-i-dont-know-better, but please dont’ use the word science. The fact you have this site is showing that you don’t know any better than datatypes.
crowding said,
February 20, 2013 at 3:11 am
Ladies and gentlemen: a MATLAB user.
pisto said,
February 20, 2013 at 4:07 am
I am a physicist, and matlab is the worst thing I’ve ever seen. Not just because it’s bad, but because accolades say it’s great and “it’s fast with vector operations”.