Live data from Hacker News

In Defense of Matlab Code

runmat.org

1–10 of 174 posts

Re: In Defense of Matlab Code

#2
There's also Julia.

Earlier in my career, I found that my employers would often not buy Matlab licenses, or would make everyone share even when it was a resource needed daily by everyone. Not having access to the closed-source, proprietary tool hurt my ability to be effective. So I started doing my "whiteboard coding" in Julia and still do.

Re: In Defense of Matlab Code

#4
Interesting... I wrote a similar post about MATLAB's syntax a while ago, and I still think MATLAB is one of the best calculators on the market.

RunMat is an interesting idea, but a lot of MATLAB's utility comes from the toolboxes, and unless RunMat supports every single toolbox I need, I'm going to be reaching for that expensive MATLAB license over and over again.

Re: In Defense of Matlab Code

#7

There's also Julia. Earlier in my career, I found that my employers would often not buy Matlab licenses, or would make everyone share even when it was a resource needed daily by everyone. Not having access to the closed-source, proprietary tool hurt my ability to be effective. So I started doing my "whiteboard coding" in Julia and still do.

Precisely; today Julia already solves many of those problems.

It also removes many of Matlab's footguns like `[1,2,3] + [4;5;6]`, or also `diag(rand(m,n))` doing two different things depending on whether m or n are 1.

Re: In Defense of Matlab Code

#9

> # We must reshape X to be a column vector (3,1) > # or rely on broadcasting rules carefully. > Z = Y @ X.reshape(3, 1) Why not use X.transpose()?

It doesn't seem to be the example here, but I know that X.transpose() does not work if X is a (3,) and not a (3,1), which is the common way to present vectors in numpy. MATLAB forcing everything to be at least rank-2 solves a bunch of these headaches.

Re: In Defense of Matlab Code

#10

> # We must reshape X to be a column vector (3,1) > # or rely on broadcasting rules carefully. > Z = Y @ X.reshape(3, 1) Why not use X.transpose()?

Actually, I just tried Y @ X in Numpy and it works just fine.

It's because in Python 1-dimensional arrays are actually a thing, unlike in Matlab. That line of code is a non-example; it is easier to make it work in Python than in Matlab.

Post reply on HN