Hacker News new | ask | show | jobs
by grahamas 1267 days ago
> I’ve found it very useful but it took a fair amount of time to build up the set of tricks to doing things right.

What kind of tricks are you thinking of?

> I wonder if Matlab being most hated relates to people being forced to learn it in undergrad and it being poorly taught etc.

To me, as someone who has used Matlab fairly extensively both being taught in undergrad and in programming-centric grad research, Matlab's one and only strength is in its being a one-and-done IDE/programming language. If you're using Matlab, then you're using it in an IDE that "just works" and was installed and configured simultaneously with Matlab itself: there's no real distinction between the two. Further (assuming you check the right boxes during installation [1]), all the possible packages you could ever have [2] are installed at the same time. So you get a super simple install and never have to think about installing or configuring anything ever again. I don't want to minimize how useful this is. Every other programming language I've ever used has had a huge amount of installation and configuration overhead, often an insurmountable barrier for non-programmers (e.g. scientists).

That said, I dread using Matlab, for many, many reasons. My top three reasons in no particular order: 1. you can only really define one function per same-named file, 2. errors are almost always one line long (no stack trace) and rarely give a line number in normal usage, 3. cell arrays. Cell arrays are basically just untyped lists, yet somehow mind-bendingly confusing to use.

[1] assuming you paid for the right to check those boxes. If anyone is wondering, to get all the boxes in a non-personal context would cost 100x more than whatever you're thinking (which is a bit of a straw man since no single person needs all the packages and institutions get crazy bundle deals). I haven't taken the time to add it all up, but base MATLAB is $900/year/computer, and each of the ~100 packages costs $500-2000/year/computer (skewing heavily to $500). So, roughly $50k/year/computer for everything. Which is silly, obviously. Most people only want a handful of packages so realistically it's only about $2-4k/year/computer. Only. However! If you just want it for non-commercial, non-academic, non-governmental use, you can buy Matlab for only $149 + $45p, where p is the number of packages you want.

[2] Literally, all the packages you can have. Package development is 98% limited to Mathworks-official packages.

1 comments

Yea I would say the main set of tricks related to using cells, working with large text files, and working with things like meshgrid as a few examples. Super easy to get confused even with good documentation and examples. Matlab benefits from the various people who work at mathworks who fix things and communicate with customers when you find odd issues.