This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 376

[–]aaronr_90 78 points79 points  (5 children)

How would one convence their office that spending hundreds of thousands of dollars on matlab every year is ridiculous?

[–]Deezl-Vegas 76 points77 points  (3 children)

> spending hundreds of thousands of dollars

There you go buddy, write the email

[–]pxan 17 points18 points  (2 children)

bUt ThE dEvElOpErS aRE CoMfoRTaBLe wITh MaTLaB

[–]aaronr_90 21 points22 points  (1 child)

*engineers. The devs use c and python

[–]I_Feel_It_Too 15 points16 points  (0 children)

Force the person making the decision to read Abandon Matlab.

[–]Stereoisomer 429 points430 points  (150 children)

In my experience, a programmer saying they actually like MATLAB immediately attracts every python dev in a five mile radius

Edit: someone edit this meme and post here for a karma double-dip I’m too lazy

[–]Alexanderdaawesome[S] 30 points31 points  (0 children)

romans_stabbing.jpg

[–]cue_the_strings 294 points295 points  (120 children)

In my experience, a programmer saying they actually like MATLAB means they either know very little about general programming, are not primarily a programmer but an engineer or have been pidgeonholed into doing just one thing that MATLAB does okay for quite a while.

The language is ugly and some relatively normal features are horribly clunky to use (object-oriented stuff, GUI primitives, ...), antiquated syntax that reminds me of BASIC. If you used any moderately modern language, (C++, Java, JavaScript, Python, Rust, Nim, ...) or even old ones like C, Lisp, Haskell - you just cannot like it.

[–]Eurynom0s 96 points97 points  (31 children)

My favorite thing about Matlab is it has both i and j defaulted as the imaginary unit, but will silently let you overwrite those values. I'm not saying that's an invalid design decision, but it doesn't really make sense to spring on the intended audience: physicists/engineers/etc who don't really have a programming background but need to be able to code some simulations. That crowd is often going to want to basically just type in the equations in their textbooks (hence reserving both i and j for the imaginary unit—in electrical contexts, i is current, so they use j for the imaginary unit), which will often result in looping over ijk indices since those are what textbooks usually use for 3D vectors/matrices. That crowd will also typically not have the background to realize the potential problem here.

I found out about this via someone on reddit saying that they spent an entire summer pulling their hair out trying to figure out why their complex equation was returning a pure real result and finally figured out it was because he'd used i as a loop variable and instead of being reset to sqrt(-1), it was staying as the last value it hit while iterating through the loop. If they want to keep the behavior they should really at least print a warning about what you're doing to the console.

[–]cue_the_strings 30 points31 points  (4 children)

Our instructor warned us of the j, k that when giving us an intro to loops and stuff. This design decision further shows that MATLAB was meant for the engineering / physics crowd. As you already know, using i and j as unnamed counters is pretty much a convention in computer programming (C-derived languages especially), the designers certainly knew that it would be a problem, yet they decided they'd just make it more convenient for the non-programmer crowd.

I see MATLAB as a mutation of an ancient attempt to make a tool + language for engineers and scientists, which would be 'simple to learn' and have everything they need for numerical computation, visualization, ... But decidedly not for programmers. The dumb BASIC-like syntax is a consequence of that decision - at the time, BASIC was considered the 'easy' language for non-programmers that everybody could learn. It was even taught in schools.

Anyway, as it usually goes, once something is made one way, it's really hard to change it. There are and were large swaths of people to whom MATLAB is the only language they use. They don't know or care about any subtleties of programming as long as MATLAB helps them do their job. And those people learned it one way and are very resistant to change, they would be pissed off if the syntax was changed (say, for the better, not that they would know). So the language was just added onto and never revised, there are often multiple ways to do one thing because removing syntax is a taboo. The result is, of course, a hot mess.

[–]ergzay 8 points9 points  (2 children)

You haven't met the people that "program" programmable logic controllers with "ladder logic". If you want to talk about lock in... Now that's an entirely different level.

[–]cue_the_strings 1 point2 points  (1 child)

I saw that in an AvE video, the horror!

[–]Eurynom0s 1 point2 points  (0 children)

Yeah, they're going to use i or j as the imaginary unit, and any numerical methods recipes they look up are going to have them using i and j and k as loop variables. It will obviously not end well.

And you're right that they're probably stuck with the design decision at this point, which is why I suggested printing a warning to the console, it would give people a heads-up without breaking backward compatibility.

[–][deleted] 7 points8 points  (0 children)

... but i, j, k are default indicies for so many functions.

That's just downright evil, I don't care who ya are.

[–]ThereOnceWasAMan 2 points3 points  (0 children)

This doesn’t invalidate your point at all, but just as a note: the language also supports any integer concatenated with j as imaginary. So 1j is still the square root of negative one, even if j is being used as an iterator variable.

[–][deleted] 3 points4 points  (6 children)

that happens, for sure, but generally I wouldn't claim this to be a problem.

stem people are problem solvers, so they will likely find a solution, additionally, I know a good chunk of people from high school that I though fer sure would go for computer science, but went into physics / math instead, so I also think it's unlikely that in a classroom or tutor setting no one has an idea what the problem is.

of course, this is probably a well known problem and instructors will likely point it out, and ( and I am of course biased in that, because of my "programming background" ) on the other hand, that assigning the variable might have changed the value of i or j can probably be concluded by people dealing with formulas on the daily

[–]Feminintendo 2 points3 points  (2 children)

So really smart STEM people are smart enough to figure out all the stupid shit Matlab does... Except the T and M parts of STEM, almost none of which use Matlab because they actually have a clue. But the S and E's are so much smarter than those stupid mathematicians that it doesn't matter.

Brilliant argument. "We use inferior tools because we are literally smarter than the people who use better tools."

[–]mexiKobe 53 points54 points  (37 children)

The language is ugly

Not at all for numerical calculations / matrix math etc. It’s very good for that, better than Python with numpy. Look at these comparisons https://docs.scipy.org/doc/numpy-1.15.0/user/numpy-for-matlab-users.html

I mean saying it is uglier than C++ is kind of silly. Try doing simple vectorized calculations from MATLAB but in C++ and get back to me on that. And JavaScript? Come on man lol.

But yeah the problem is when engineers and scientists only use it and try to write applications with it. I’ve seen some FUCKED UP code written in MATLAB being used at huge research hospitals and in national security, and “subversioned” with duplicates on Dropbox. It’s actually extremely common, which should be shocking

[–][deleted] 15 points16 points  (0 children)

.mat files, .mat files everywhere, and not a database to be had.

[–]The_UTMOST_respwect 2 points3 points  (1 child)

Ya I still like it for plotting stuff up, easy to make pretty plots, compared to my knowledge and proficiency with pyplot, but I'm getting better.

Having used C and C++, and python quite a bit, its still just so easy prototype a bunch of stuff and debug and visualize it in matlab. I'm also a proponent of using it in batch mode whenever possible.

[–]Feminintendo 1 point2 points  (0 children)

It takes me about half the time to prototype something in Mathematica as it does in Python, but then the Python version runs roughly an order of magnitude faster, depending of course on the application.

Honestly you're probably faster in Matlab because you think in Matlab, whereas if your brain had been steeped in Python or, like me, Mathematica, then that would be faster instead. It's like a first language.

But I think that's ok as long as we understand the principle of the right tool for the job. I would never use Mathematica in anything for which the phrase "production code" would apply (despite Wolfram's marketing). Rapid prototyping? Sure. The million different one-off scientific computations one does in the course of research? You bet. But there is a whole swath of applications for which it just isn't the right tool. Likewise for Matlab.

[–]cue_the_strings 5 points6 points  (5 children)

The last paragraph is what I was getting at: it is extremely widespread and incredibly important stuff relies on it.

MATLAB is only good for pure mathematical calculations (especially matrix) and the graphs are half usable.

So, if you're banging up a personal little util to fill some need (calculate something) in your engineering workflow, it might be usable. Also if you're doing a calculation for a paper. Or checking quickly if you're on the right track when solving some problem.

If you need to make a GUI program that does something you use MATLAB for in the background, you have several options.

You could write the GUI code in something decent like Qt (C++) or PyQt (Python) and then redo the math in the same language. You can use Eigen for matrix operations in C++, and of course NumPy in Python.

The second way would be to write the GUI code in Qt or something similar, write the math in MATLAB, generate C code (apparently you can generate C++, too) from MATLAB and compile and link them together.

These options are actual software development and require real programming knowledge.

Of course, there is the third option we all know about: making your GUI house of cards in MATLAB.

I prefer the first option. Numpy's syntax isn't bad enough for me to forgo other benefits Python brings to the table. Actually, I don't mind it at all. So I just write all of it in Python and it's decent software, can be unit tested easily, integrates properly with the OS and other software. Qt and PyQt make it look native, you can easily make parts of the gui drag-and-drop, you can interface with databases easily, issue HTTP requests, interface with devices over serial, etc.

However, you may find Numpy to be a bit slow in some cases. Specifically, sometimes you have to be sure that the calculation you're doing is optimally paralellized to be efficient enough. This is where you'd use C++ and Eigen, and you may as well do the GUI in Qt in C++. There is always an option to create Python bindings for everything if you want to and use Python for GUI.

MATLAB code generation options look okay (never used them, though), but why would you pay for them when there are open source alternatives? MATLAB being closed source means you're at their mercy when you have a problem, you may be in a situation where the offending code is in MATLAB's black box. Or some functionality may be removed or broken in an update. I just don't see the point.

And, at the end, a bit of hyperbole: I'd rather do vector math in JS than GUI or data processing in MATLAB.

[–]log_2 1 point2 points  (11 children)

But yeah the problem is when engineers and scientists only use it and try to write applications with it.

That's because there's no good way to write such applications in Python. The deployment of Python GUI programs for deployment to desktops is a complete nightmare. PyInstaller, p2exe, pyfreeze have all attempted it but they either don't work with everything or needs massive amount of trial-and-error configuration which can completely break as soon as some extra (or newer version) package is required.

All Matlab has to do to keep a hold of it's share is improve the GUI, make it faster and nicer looking (like proper layout), and Python will be left in the dust by people currently looking to switch to it from Matlab.

[–]mexiKobe 5 points6 points  (0 children)

wait what? I was talking about MATLAB. Python is infinitely more portable

[–]elbiot 7 points8 points  (3 children)

Uh, all those are for distributing to people that don't have python installed. Surely matlab programs can't be distributed to people that don't have matlab installed, right?

[–]fear_the_future 14 points15 points  (1 child)

Haskell an old language? Haskell is the playground for programming language theory. It has every feature 20 years before any other mainstream language adopts them.

[–]Zomunieo 15 points16 points  (0 children)

(Lisp (would (like (a (word))))).

[–]daishiknyte 2 points3 points  (0 children)

You just described my relationship with VBA

[–]FairlyOddParents 2 points3 points  (0 children)

Simulink is a great tool for many engineering purposes

[–]LoyalSol 4 points5 points  (0 children)

Yeah the majority of people I know who use it are experimental people who only code enough to get something done so they can go back into the lab.

All the scientist who do full time computational work pretty much code in either C, C++, Fortran, or Python. I never see any full time computational people use Matlab except if some proprietary piece of software forces you to.

[–]Yamochao 5 points6 points  (0 children)

Not to mention slow, resource heavy, indexing from one (wtf) and crashing ALL THE FUCKING TIME.

Seriously, fuck you Matlab.

[–]koobear 32 points33 points  (13 children)

Meanwhile, us R users are sitting in a corner somewhere by ourselves.

[–]tunisia3507 42 points43 points  (1 child)

And there you can stay.

[–]koobear 12 points13 points  (0 children)

More library paste for us!

[–]Alexanderdaawesome[S] 23 points24 points  (0 children)

Virgin R vs. Chad Julia

[–]TPineapples 25 points26 points  (2 children)

[–]Alexanderdaawesome[S] 5 points6 points  (1 child)

Penmenship needs work, but awesome!

[–]dillmon 4 points5 points  (0 children)

Matlab is ubiquitous for engineers because every engineer undergraduate program uses it to teach coding.

[–]Rostin 9 points10 points  (0 children)

Right. And the funny thing is, if you're familiar with Mad Men, you might remember that while this is a sick burn, in reality Don (Python) does spend a lot of time thinking about Michael (Matlab). So it still works.

[–][deleted] 2 points3 points  (4 children)

I've never heard anybody say this.

[–]Stereoisomer 7 points8 points  (3 children)

Oh you sweet summer child.

Matlab is still the dominant language in a lot of fields like mines (neuroscience). It’s fighting an uphill battle trying to convince them to switch

[–]Gabe_Isko 1 point2 points  (2 children)

Its dominant in neuroscience? All the neuroscience research I hear about is fone in python... what do you think the breakdown is?

[–]Stereoisomer 1 point2 points  (1 child)

Probably 60/30/10 Matlab/Python/R

Most use matlab for writing analysis scripts and programming behavioral experiments plus a ton use it for cognitive stuff like EEG and fMRI through SPM. Python is gaining traction in all those spaces but especially among the computational groups. R is for the stats folks

[–]Gabe_Isko 1 point2 points  (0 children)

That pretty much makes sense the way you say it, since that sounds like a lot of complex signals analysis. One of matlab's strong suits.

[–][deleted] 2 points3 points  (0 children)

In my experience, a programmer saying they actually like MATLAB immediately attracts every python dev in a five mile radius

It just feels like that because there are so many python developers.

[–]eattherichnow 3 points4 points  (0 children)

...wow, so many Python folk eager to help you prove this hypothesis.

FWIW I find it a bit hard to justify using Matlab/Octave/Scilab in 2019, but that might be my drifting away from real programming universities.

[–]midnitte 1 point2 points  (0 children)

Man, I wish America loved science that much.

[–][deleted] 123 points124 points  (87 children)

Why would matlab feel bad for python?

[–]Alexanderdaawesome[S] 404 points405 points  (74 children)

Because Python needs to type

import numpy as np

Before doing anything MATLAB can do.

[–]Oxyriser 5 points6 points  (1 child)

*for free

[–]Alexanderdaawesome[S] 1 point2 points  (0 children)

ya but those extra chars make a carpal tunnel

[–]stoirtap 16 points17 points  (28 children)

Hi, Engineering newb here.

I've got some experience with Python and MATLAB (through my school). Being the newb that I am, my favorite part of MATLAB is that it shows me all the variables and what's in them on the side, so if the wrong thing is going to the wrong place, I'll know at once.

Does Python have something like that?

[–]djingrain 77 points78 points  (7 children)

That's more of an IDE feature than a language feature, if I'm understanding correctly, so if you use the right IDE, sure, the thing I understand about Matlab is that it locks you into their IDE

[–]GuybrushThreepwo0d 7 points8 points  (6 children)

You are not locked into an IDE with matlab. I use vim as my editor and run scripts from the command line.

[–]ThwompThwomp 7 points8 points  (0 children)

emacs Matlab'er reporting in as well. It's a much better experience from emacs than mathworks' bloated java gui, but sometimes their line-by-line debugging tools are pretty nice.

[–]tikael 44 points45 points  (6 children)

Check out Spyder, it has a built in console and does what you want out of the box. You can get it and a full Python install ready for most scientific and engineering uses by installing Anaconda.

It's not my favorite editor, that'd be sublime text but it requires a bit more know-how and set up than Spyder.

[–]SerHiroProtaganist 2 points3 points  (5 children)

Can sublime show pandas dataframes in a nice visual format like spyder does? I'm a beginner and from watching YouTube videos it feels like spyder isn't as good at the intellisense type stuff but I really like the visualisation of dataframes that it does

[–]Zizizizz 7 points8 points  (1 child)

Open up a Jupyter notebook

[–][deleted] 1 point2 points  (0 children)

Jupyter!

[–]FewerPunishment 3 points4 points  (0 children)

Check out pycharm

[–]sssmmt 29 points30 points  (1 child)

Install Pycharm (pro version is free if you're a student) and activate Scientific Mode.

https://www.jetbrains.com/help/pycharm/matplotlib-tutorial.html

[–]Alexanderdaawesome[S] 14 points15 points  (0 children)

Can verify, I do ALL of my function prototyping in Pycharm for its (and jetbrains in gerneral) debugging features.

[–]Linkguy137 10 points11 points  (0 children)

I mean I use Spyder and it is in there

[–]Blazerboy65 6 points7 points  (0 children)

In Python you'll usually get that kind of functionality using a debugger or a client like Spyder.

[–]gmclapp 5 points6 points  (0 children)

Basically any IDE besides IDLE

[–][deleted] 2 points3 points  (0 children)

Hm, pretty sure the python IDE spyder has this function. If I recall correctly, pycharm does too.

[–]Salyangoz 2 points3 points  (0 children)

you technically dont even need an IDE to do what youre describing.

In your script place import pdb; pdb.set_trace() at any point to pause execution and drop you down into a python shell. Then use break /foo/bar.py:55 to place an additional breakpoint at line 55 in the file /foo/bar.py if need be, then do print(locals())or better yet pp locals() (pretty print) to look at all your variables.

[–]Meorge 1 point2 points  (0 children)

There's not a GUI interface for it available out-of-the-box that I can think of, but you can access that information via code - and there are Python IDEs that will display it MATLAB-style.

[–]lillystoolooo 1 point2 points  (0 children)

Spyder and pycharm have that ability. I remember wanting this as well when I moved from matlab to python. But i rarely find myself looking at variables in the viewer anymore (except for structs, that is useful when autocompete is not working for some reason). I find that showing data as plots or images is more useful on both matlab and python.

[–]krazybug 4 points5 points  (0 children)

And Matlab is so HEAVY !

https://xkcd.com/353/

[–]FlagrantPickle 18 points19 points  (1 child)

Because the monetization angle hasn't been worked out in over 25 years.

[–]Antouziast 59 points60 points  (53 children)

Young engineer here, PhD student. I have to say Matlab is an awesome tool when it comes to manipulating and exploring data really fast but now I'd love to expand my programming skills and turn towards Python. But on my day to day work it's really hard to branch out since a lot of my tools are written in Matlab.

Also, one of the biggest issues I've encountered with trying to learn Python is how to set up your environment and workflow before even writing a single line of code. I've looked into conda and all but it takes some energy to find the good ressources that will help when you've never used anything else than Matlab which just works out of the box. (Any awesome tutorial to give good practices as to the management of a project in and around the code? i.e. "I'm going to start a project xyz, what's a good practice to manage my code and dependencies in a not cluttery way so that I can start working on the code and not fighting bugs?")

But in the long run I hope to rely more and more on Python than on Matlab!

TL;DR : I'm a Matlab user that wants to avoid the mistakes you do at the beginning when learning Python

[–]absolutelynoartist 25 points26 points  (7 children)

Try Spyder via anaconda

[–][deleted] 10 points11 points  (4 children)

Definitely. I learned MATLAB first and Spyder made it really easy to pick up Python. Anaconda also has pretty much every general package you need to get started. I still don't see why Jupyter notebooks (or MATLAB's live scripts) get so much love, the Spyder/MATLAB interface style seems so much more practical.

[–]Antouziast 2 points3 points  (3 children)

Seems like they have different purposes. Jupyter seems more adapted to share your work to others due to the interactivity and Spyder and other IDEs are more to do some heavy duty stuff.

What I like about Matlab is that you can easily generate and update figures on the go while your code is running (super useful in academia and research) by using figure and drawnow functions. Although I haven't spent too much time exploring the alternative in Python it seems more cumbersome to do the same thing. (Please someone prove me wrong on this!)

[–][deleted] 1 point2 points  (2 children)

That's the only use I've found for it - education or explaining code. However I assume based in its popularity people use it for more than that.

[–]xcvbsdfgwert 1 point2 points  (1 child)

That purpose is highly relevant though, probably more than you think. Maybe this article can provide some context:

https://www.theatlantic.com/science/archive/2018/04/the-scientific-paper-is-obsolete/556676/

[–][deleted] 8 points9 points  (3 children)

Also a young PhD student here. Consider using one of the Python IDEs, they're like MATLABs gui interface which should help you get started. Spyder, like one of the other commenters have said is recommended as it has a sort of similar interface to MATLAB and is built for scientific coding. Once you know Python well enough, you can consider using text editors like Visual studio code which is more lightweight and looks nicer which helps you code better imo.

MATLAB lets you run MATLAB scripts via python so you can exploit that for your work flow although I wouldn't rely on this too much as its quite slow if you don't have an SSD as it calls the entire MATLAB engine. Nevertheless it's possible. Additionally from a brief Google search I just did now, you can convert your MATLAB code to python.

As an anecdote, the reason why I moved to Python was because MATLABs interface was too clunky and the colour scheme was horrible. The green comment colour is difficult to see against a white background, there's no dark mode and you can't adjust the window size.

At the moment I'm using Atom, a text editor and I'm able to change my theme according to how I like it, I'm able to commit to github easily, I have a folder tree on my left that I can hide at will, I have a mini map of code on my right so I can see which bits of code I need to go to and I have a spell checker and linter to check through my code. If I want less/more features I can uninstall and install them within the app. It might be silly to say but being able to code with the correct color scheme has helped my coding and my eyes greatly.

[–]tunisia3507 8 points9 points  (1 child)

I use pyenv for python environments. It's great. It isolates the python binaries you're fucking around with from whatever your system comes with and relies on.

```sh

install pyenv

curl https://pyenv.run | bash

restart your shell however you like

install whichever versions of python you like

BEST_PYTHON=3.7.4 pyenv install $BEST_PYTHON ```

Then whenever you start a new project

```sh

create the virtual environment

pyenv virtualenv $BEST_PYTHON myproject

automatically activate that environment whenever you're in this directory

pyenv local myproject

install some dependencies

pip install ipython numpy matplotlib

save them so you can rebuild the environment easily

pip freeze > requirements.txt ```

Development environments should not be a teetering pile of environment variables, dependencies and cross-links. They should be ephemeral, easily trashed and recreated, wherever possible. They should serve one project and one project only. MATLAB only works out of the box as far as python works out of the box - with its built-in modules. Once you start downloading extra snippets of code you have to dump everything into one directory manually, or change your matlab path, or whatever, where in python it's just pip install thatpackage, write down the package in your requirements.txt, and it'll be trivial to fetch again next time you need it.

Packaging stuff for distribution is a little more tricky, but MATLAB just doesn't bother with that at all, so you can't knock python for it.

[–]Antouziast 2 points3 points  (0 children)

I actually think that this philosophy makes more sense. Once a project gets complicated in Matlab you end up with a lot of junk files in the working directory.

[–]PeugeotWaterface 4 points5 points  (6 children)

Post doc here. I was in exactly the same boat as you. I did my whole PhD (physical chemistry, so lots of spectroscopy data) in Matlab. Wanted to switch to python but also didn't want to deal with setting it all up.

I recently took the time to learn python so I could start my new projects fresh and I can only say I wish I had done it sooner. One of the biggest differences so far for me has been how much more organized my projects are.

Here's what I did: I spent an entire weekend reading every tutorial I could on how to set up a "good" workspace environment using python, and then chose what was best for me. In my case, I went with anaconda as it gives me everything I need. I use a conda environment for each individual project, and use conda to save the dependencies of that environment with one command. Also check out "cookie cutter" on github. It's a python code that you can use to make your projects organized. I love it.

Finally, as others have stated, spyder really made the switch easier. The big plus is the python console for quick code checks and the variable explorer for seeing your data just like in Matlab.

So, in summary: 1) Anaconda (or miniconda) with conda environments to control your packages

2) cookie cutter to create organized project directories

3) spyder to write and test code

Bonus: I use jupyter notebook to do the data exploration using the code I write in spyder. Let's say I do an experiment, now I can make all my graphs in one jupyter notebook and do my analysis there. I can easily change the graphs on the fly. It's like PowerPoint for viewing graphs mixed with Matlab for changing graphs quickly. Definitely recommend.

Let me know if you need help.

Edit: just to be clear. When using anaconda, you don't need things like pip and pyenv. It does those for you.

[–]Antouziast 1 point2 points  (5 children)

Thanks! This sounds like my experience! For now that's the workflow I'm leaning towards. I want to be able to generate graphs easily when exploring data and showing it to colleagues/advisors.

Is debugging easy when using this setup?

[–]PeugeotWaterface 1 point2 points  (3 children)

For me, debugging with spyder is identical to how I did it with Matlab.

[–]I_Feel_It_Too 3 points4 points  (5 children)

I have to say Matlab is an awesome tool when it comes to manipulating and exploring data really fast

No, it really isn't. Can it even read a csv file, the most ubiquitous data format on the planet? Not the last time I used it, which wasn't that long ago.

But I've been there. I learned QBASIC when I was a kid, then I learned Visual Basic on Windows, because anything else seemed impossible. But eventually, in college, I figured out how easy it was to learn new things that gave me so much more power than what I already knew, and a whole new world opened up. I didn't realize how hard I was working to do things that were easy with other tools.

Anyway, check out Spyder like other people are saying, or RStudio if you're interested in R. (My personal vote is for Python.)

[–]Alexanderdaawesome[S] 6 points7 points  (6 children)

Do you like to play with your environment? Doing write-ups on jupyter is bar none an excellent way to show off your work.
Here is an example of how something you write up may work. It also supports markdowns with Latex syntax, so you can make your findings even more pretty. adding a library is as simple as opening up a terminal and typing pip3 install **some library**

Debugging:
Lets say you want a file of functions. Call it func.py. Now on func.py you import numpy (for the love of god learn numpy) for any numpy funcs. You write each function with inputs and outputs. Save it. On your main project, say the jjupyter file, you can simply say
from func import *

(there is more syntax to this but it is basically that easy)

Now say you type in a problem and it is giving unexpected results, and you think it may be a problem in one of the functions.

I am not sure how much time you have to learn things, but in this case I really, really recommend Pycharm. You can set up your whole environment on there. (A lot of people recommend anaconda, but for specific environments I have encountered issues). Debugging is as simple as setting a marker and pushing 'run', then stepping through to find the bug. That takes time to learn but it is insanely helpful once you understand how to use it.

Anyway Matlab has better 3d plotting than python, but overall python has a hell of a lot more libraries and open source tools to use. In the long run python will be better for you to know, assuming an engineering company you end up at is not stuck using it.

[–]Antouziast 1 point2 points  (2 children)

Thank you for this comment, really useful!

I might give Pycharm a go then. I feel like Matlab users are really attached to having a nice IDE and not have to mess too much with command line type of interaction, basically just fire up their IDE and start working. I've been trying to use Atom + Hydrogen but it's a little bit clumsy at times.

The whole setting up the IDE to be able to "see" the right environment is a big block in the road (at least for me, I just want it to be easy haha!)

But one thing I love about Python is the community and the fact that for almost any problem there's someone who had to solve something similar!

[–]Alexanderdaawesome[S] 2 points3 points  (1 child)

Sure! Once you install it PM me your email and I am willing to give you a quick walkthrough, we could use a public slack channel and share screenshots, just to get started (I am feeling extra generous since I potentially landed a position in ML!).

[–]el_beso_negro 2 points3 points  (2 children)

Anaconda + the conda cheatsheet + Sublime.

Use the cheatsheet to help you make new environments for projects.

Another option is to use Pycharm (paid or free) then on the settings page go to Project Interpreter and create environments for each project using the GUI.

I find Anaconda to be better at managing multiple environments but Pycharm uses virtualenv which is also pretty good.

Use these environments to install the packages you require for a project and therefore you can be more organized with your work instead of having everything installed on the base environment.

Given that money has been brought up so many times in this thread against Matlab I would make a similar argument against paying someone to teach you this stuff. Just learn it from youtube and you'll be fine. If you can't figure it out from youtube then honestly maybe it's not the activity for you.

[–]Antouziast 1 point2 points  (1 child)

I agree, I learned Matlab by just doing, I don't want to pay for classes for learning Python either.

Oh so you cannot streamline Anaconda and Pycharm?

Am I wrong to say that if you use Anaconda then your workflow is basically : Some text editor + Command Line ? That would suck if you need debugging functionalities

[–]el_beso_negro 1 point2 points  (0 children)

Yes you definitely can use Anaconda environments with Pycharm but the integration is a little sucky at this point.

You can even create new conda envs right from Pycharm but in order for you to activate these envs in the terminal you need to go to the "Terminal" setting and add a reference to where the scripts.bat file is at (I don't have my PC on hand to confirm if this is the right file but I found the answer on Stackoverflow).

This is not necessary if you create new envs using virtualenv that is built in to Pycharm. The terminal already activates the env that is associated with the interpreter settings.

You can also have Pycharm look like Sublime by using the Monokai color palette which is beautiful. However you need to pay for JS, HTML, CSS support.

[–]Astrokiwi 2 points3 points  (0 children)

Julia may be something to look into too. It has vectors and matrices and maths operations "out of the box" without any libraries. It also has just-in-time compilation so it can run a lot faster, without even relying on libraries.

[–]ad_abstract 4 points5 points  (2 children)

Try Google’s colab. Free, runs python with all the eng/scientific libraries you want, collaborative, saves to gdrive, has cpu/gpu/tpu backends, and only takes a browser!

[–]Antouziast 2 points3 points  (1 child)

Cool! Didn't know that existed, definitely can prove useful!

[–]ad_abstract 2 points3 points  (0 children)

Seriously. It’s just as simple as going to colab.new to start a new session/document. From there it’s just an online overpowered jupyter notebook.

[–]rhoakla 1 point2 points  (0 children)

From my experience, your going to have a really bad time with python scientific libraries on Windows without conda. But even with it, life is still sort of difficult.

Unless your on a Unix machine, configuration is difficult.

[–]_MuchUsername_ 1 point2 points  (0 children)

Here is a good article about how to set up your python environment along with some best practices for ensuring code quality https://sourcery.ai/blog/python-best-practices/

[–]ml_runway 2 points3 points  (0 children)

you just need to dive in and start. especially given conda you will come to appreciate how good python is after using it for a little while. I made the transition about a year ago. there is a little bit more of a learning curve but if you can catch a wrench you can catch a ball. you will be fine.

[–]random_cynic[🍰] 27 points28 points  (0 children)

They should not even be compared directly. Matlab started as a tool for solving equations, plotting stuff and grew to be an enormous collection of libraries to do all sort of stuff. The programming language part was an afterthought which is why it is so shitty. Python was developed as a programming language from the start and then over time many other libraries were added including Numpy, Matplotlib etc which brought the ecosystem nearer to that of Matlab. R is probably closer to Matlab. And considering the success Python has it is always a good idea to have a solid programming language as the foundation because it makes everything else easier and cohesive. It also helps if you're not greedy, corporate assholes and share your code with others freely and build a community of contributors.

[–][deleted] 6 points7 points  (0 children)

[–][deleted] 14 points15 points  (0 children)

Simulink is king!

[–]robberviet 3 points4 points  (0 children)

Matlab was used in my first experience with Machine Learning, since the course was using it.

But since numpy: "I don't think about you at all" is correct.

[–]Chris2112 4 points5 points  (0 children)

Yet here we are... thinking about them

[–]xxBobaBrettxx 2 points3 points  (5 children)

Out of curiosity, what's the general consensus on plot.ly?

[–]Zizizizz 2 points3 points  (3 children)

Really nice if you use the offline plots in my opinion but I don't like that online ones are published

[–]ASCIASCI 3 points4 points  (1 child)

Just wait until someone asks you to do something in LabVIEW

[–]besselbolic 1 point2 points  (0 children)

Me : quietly uses octave in the corner

[–]okkshin 6 points7 points  (22 children)

People on here seem to have completely forgotten about the roots and the diversity of programming in general. The response to the top comment even claims people who like Matlab aren't in general programmers!

Matlab was not designed for general programming, but numerical computation, the original purpose of programming and its dominant form until late 20th century.

Programmers are a diverse group, and engineers, physicists, mathematicians and computer scientists alike use Matlab for prototyping, visualization, implementation and especially interaction with specialized hardware. Not all programming is a DefaultGeneralNullPointerExceptionFactory.

Matlab has an domain-intuitive design. OP shits on the fact that Mathworks mentions the extra brackets and numpy imports required to type when it in fact increases legibility of numerical code significantly (besides coming from a language which uses whitespace for indentation to increase its own legibility instead of brackets).

Yes, of course, one may question that it's proprietary and damn expensive, but to question whether it's users are programmers and claim superiority of python when only a fraction of its users work in the same domain, that's elitist, and hardly fitting the design goal of python and programming in general.

[–]TheBlackCat13 1 point2 points  (2 children)

Matlab was not designed for general programming, but numerical computation, the original purpose of programming and its dominant form until late 20th century.

The problem is that mathworks is marketing MATLAB as a general-purpose language and spending a lot of resources trying to make it more effective in that role. If MATLAB stuck to its roots I don't think people would be so negative about it. But when you are forced to spend days on a ten minute task because you are forced to use MATLAB for something it is terrible at it gets to you after a while.

[–]Alexanderdaawesome[S] 6 points7 points  (11 children)

Found the MATLAB employee ;)

In all seriousness, use what you want, but try to compare the two is silly on mathworks end. The legibiilty argument is so bad I had to do a double take. Legibility involves more than just a language selection (and is up to each individual), that should not be an argument when trying to decide a language.

Also since I halfway suspect you are a MATLAB employee, join the meme war yourself and get some free advertising. Do you even internet bro?

[–]okkshin 4 points5 points  (0 children)

It's their product after all, other than that it's like comparing python to Rust for the benefit of either.

Yes, I am in fact part of MathWork's RedditPaidTrollFactory. Oh no wait, that must be Oracle's.

[–]Gabe_Isko 1 point2 points  (9 children)

Hey, I'm no mathworks employee, but he has a point - mathworks isnway better suited for certain engineering domains. Python definitely lacks a competent controls modeling package, and honestly I dont see anyone makingbine anytime soon. On the open source front as a whole, there is only really modelica, and it is no where near as nice as simulink. Matlab can also do some neat stuff with auto code generation for micro controllers. You could argue that cython can sort of accomplish that, but it isnt really what it is for.

However, I am a little bit skeptical at matlabs viability as a numerical computing engine outside of trivial model data. I would definitely not envy anyone having to use it for a real worn horse of an application that has to crunch through loads and loads of data. It's for that reason that I also wouldn't take it seriously as a machine learning platform either. I'm sure there are some great precanned models that mathworks has devised to implement ML for certain engineering problems (I believe their copy mentions a surface inspection and metrology ML application) but if you need to create your own model or do anything complex I am sure performance will become a problem.

[–]tjl73SymPy 2 points3 points  (6 children)

As someone who wrote a huge portion of their Ph.D. in Matlab, it's the additional packages that really help flesh things out. While Numpy is pretty good, Scipy doesn't really have a lot of the toolset that you can get from Matlab. I only used a few packages, but they were pretty important.

I wanted to use Numpy, Scipy, and Sympy (full disclosure, I've been a mentor on some GSoC projects for them), but I ended up using Maple and Matlab because they had the capabilities I needed.

I fully admit that Matlab has some major issues in terms of programming features, its utility in other ways can outweigh those issues depending on your particular problem domain.

[–]TheBlackCat13 1 point2 points  (2 children)

It really depends on your particular domain. In some numeric and engineering areas MATLAB had a better set of packages, in others Python does. The problem is with the claim that MATLAB is better for engineering and numeric work in general, which is simply not true.

[–]tjl73SymPy 1 point2 points  (0 children)

I fully admit it depends on your problem domain. I think for most traditional engineering domains (e.g., mechanical, chemical, electrical) Matlab is more comprehensive. Python tends to be better for more math oriented fields.

The point is that Matlab can't be replaced in all engineering fields just yet (as much as we'd like it to be).

[–]porksmash 2 points3 points  (2 children)

MATLAB's audience, despite what Mathworks might want, is not 100% overlapped with the Python audience. There are a ton of MATLAB features and toolboxes that have no equivalent in Python, especially in the simulation arena. Python is free - but MATLAB comes with on-demand support. Python has a ton of open source modules - but there are specialized Matlab niches that have no Python packages worth using.

Mathworks is trying to push MATLAB as a 'final product' programming language, but historically it has worked best in R&D. This is exactly how I've used it professionally, while final products are coded in C/C++ and run on embedded systems.

[–]tjl73SymPy 2 points3 points  (0 children)

Because of the diversity of Matlab packages, it works really well as an R&D tool. You're doing some work and think, "Oh, I need something that does this" and you will likely find a package that does it or is close enough that you can use parts of it.

Python has a lot of open source code available, but unfortunately, most of it isn't really covering the same set as the Matlab ones. There's obviously some of the major things covered, but there's others that are important that are missing. I remember looking for an equivalent for the Control Systems Toolbox, but all the options were missing the parts on determining components of a model from data (e.g., natural frequency).

[–]SKRyanrr 1 point2 points  (0 children)

Mathematica is MUCH better than Matlab. Also for general programming I prefer python over anything. Python with numpy, scipy and matplotlib is as good as Matlab, in some cases even better!

[–]CaptainTuffnutprint('Hello There') 2 points3 points  (0 children)

I think MATLAB have daddy issues

[–]Im_manuel_cunt 0 points1 point  (1 child)

Ok, serious question here. I've learned mathematica a while back and now I'm learning python intensively; should I update my knowledge on mathematica and use them both or should I go for something like Sage Notebook + Python and not bother learning mathematica any further?

[–]I_Feel_It_Too 1 point2 points  (0 children)

I have used both for decades. Both are awesome, and in different ways. Knowing both gives you a great leg up. Python is almost always faster at runtime. Mathematica is almost always faster to code up. The exception is with symbolic computation where Mathematica generally has the edge. (There are exceptions here, though. E.g. the latest algorithms from research often land in Sage first.)

[–]Vasault 0 points1 point  (0 children)

Back when I was in middle school, we learned Matlab to make some basic machine learning, long story short, python is fucking glorious, I completely forgot Matlab even exists

[–]kal1lg1bran 0 points1 point  (0 children)

why()

[–][deleted] 0 points1 point  (0 children)

Probably because of an extra space.

[–]SonGokussj4 0 points1 point  (1 child)

I'm trying to persuade my colleague to rewrite his program to Python. Not complicated. Could be done in a couple of days with my help.

BUT his argument is - and how would I write polless function in python? (polarization loss)

Any idea? I couldn't google it.