125
Aug 05 '19
Why would matlab feel bad for python?
405
u/Alexanderdaawesome Aug 05 '19
Because Python needs to type
import numpy as npBefore doing anything MATLAB can do.
6
17
u/stoirtap Aug 05 '19
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?
30
u/sssmmt Aug 05 '19
Install Pycharm (pro version is free if you're a student) and activate Scientific Mode.
https://www.jetbrains.com/help/pycharm/matplotlib-tutorial.html
16
u/Alexanderdaawesome Aug 05 '19
Can verify, I do ALL of my function prototyping in Pycharm for its (and jetbrains in gerneral) debugging features.
77
u/djingrain Aug 05 '19
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
8
u/GuybrushThreepwo0d Aug 05 '19
You are not locked into an IDE with matlab. I use vim as my editor and run scripts from the command line.
9
u/ThwompThwomp Aug 05 '19
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.
→ More replies (2)3
48
u/tikael Aug 05 '19
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.
3
u/SerHiroProtaganist Aug 05 '19
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
7
→ More replies (2)4
11
7
u/Blazerboy65 Aug 05 '19
In Python you'll usually get that kind of functionality using a debugger or a client like Spyder.
6
3
Aug 05 '19
Hm, pretty sure the python IDE spyder has this function. If I recall correctly, pycharm does too.
3
u/Salyangoz Aug 06 '19
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 usebreak /foo/bar.py:55to place an additional breakpoint at line 55 in the file /foo/bar.py if need be, then doprint(locals())or better yetpp locals()(pretty print) to look at all your variables.2
u/Meorge Aug 05 '19
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.
2
u/lillystoolooo Aug 05 '19
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.
→ More replies (2)1
u/FlukyS Aug 05 '19
In python you can find out any types by doing `print(type(variable))` but most devs usually know what is supposed to be in there before they are going to make a mistake. Like for data analytics I look at the inputs first before I do anything in python just to know what I need to do and then do it. My IDE doesn't need to say anything.
→ More replies (40)4
20
u/FlagrantPickle Aug 05 '19
Because the monetization angle hasn't been worked out in over 25 years.
→ More replies (1)0
Aug 05 '19
[deleted]
13
→ More replies (6)3
u/PlusImagination Aug 06 '19
Companies pay for Matlab because the algorithms are verified as being what they say they are and supported by a staff of full time PhDs
Which algorithms are you talking about?
Post a question on stack exchange for python and maybe you'll get some advice, maybe it's relevant, and maybe it's right.
What questions are you talking about?
Not trying to poke at you, genuinely curious why some institution continue with Matlab.
60
u/Antouziast Aug 05 '19
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
6
u/Alexanderdaawesome Aug 05 '19 edited Aug 05 '19
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 typingpip3 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 sayfrom 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.
2
u/Antouziast Aug 05 '19
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!
3
u/Alexanderdaawesome Aug 05 '19
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!).
→ More replies (1)1
u/I_Feel_It_Too Aug 06 '19
Matlab has better 3d plotting than python
I am curious to know why you say that. I can embed an interactive 3D plot in a web page in Python in the time it takes me to load Matlab. The aliasing and default color scheme of Matlab's make them look like they are from 1994.
1
27
u/absolutelynoartist Aug 05 '19
Try Spyder via anaconda
11
Aug 05 '19
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.
3
u/Antouziast Aug 05 '19
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
figureanddrawnowfunctions. 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!)2
Aug 05 '19
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.
→ More replies (2)→ More replies (1)1
u/ashesall Aug 06 '19
Spyder in Anaconda is literally the only IDE that worked for me. I can't even run a script properly in VSCode and it lags on my potato of a laptop. Upgrading packages using conda is so easy too.
10
Aug 05 '19
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.
1
u/ChemistBuzzLightyear Aug 06 '19
Not that it matters because you have already switched, but the color scheme is easily changed. All you have to do is look in the settings and change it. There is also integration with git, folder tree, etc.
I want to switch to python fully, but nobody else in my lab uses it and we all write code to be shared. :/
1
u/Antouziast Aug 05 '19
I agree, a comfortable environment is important in my eyes too. I've played with Atom + Hydrogen as well and it's nice to start writing one's first scripts!
1
Aug 05 '19
Second everything here.
My transition from Matlab was greatly enhanced by Enthought Canopy. I don't use it anymore, but at the time it was wonderful.
9
u/tunisia3507 Aug 05 '19
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.
# 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_PYTHONThen whenever you start a new project
# 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.txtDevelopment 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.
3
u/Antouziast Aug 05 '19
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.
4
u/PeugeotWaterface Aug 06 '19 edited Aug 06 '19
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:
Anaconda (or miniconda) with conda environments to control your packages
cookie cutter to create organized project directories
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.
2
u/Antouziast Aug 06 '19
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?
2
u/PeugeotWaterface Aug 06 '19
For me, debugging with spyder is identical to how I did it with Matlab.
→ More replies (3)1
u/TheBlackCat13 Aug 06 '19
You want to use the jupyter notebook, then. It to designed for this sort of interactive date exploration and plotting.
4
u/I_Feel_It_Too Aug 06 '19
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.)
1
u/Antouziast Aug 06 '19
Hi! Yes it can read csv and other ASCII files actually. There's a menu called "Import data" that helps you do it and generate a script to automate it.
Thanks for the advice, based on yours and other answers I'll give Spyder another go!
→ More replies (3)2
3
u/el_beso_negro Aug 06 '19
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.
2
u/Antouziast Aug 06 '19
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
2
u/el_beso_negro Aug 06 '19
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.
3
u/Astrokiwi Aug 06 '19
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.
5
u/ad_abstract Aug 05 '19
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!
3
u/Antouziast Aug 05 '19
Cool! Didn't know that existed, definitely can prove useful!
3
u/ad_abstract Aug 05 '19
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.
2
u/rhoakla Aug 06 '19
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.
2
u/_MuchUsername_ Aug 30 '19
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/
3
u/ml_runway Aug 05 '19
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.
1
u/robotwhisperer Aug 06 '19
If you have the luxury, try using Linux. I do all my programming in Ubuntu because it's so easy to install dependencies for other languages I want to try out.
1
u/Antouziast Aug 06 '19
Is a virtual machine worth it?
1
u/robotwhisperer Aug 06 '19
I have my laptop setup to dual boot, not too familiar with Virtual Machines but I've never had a problem with my setup.
1
u/robberviet Aug 06 '19
Use Anaconda, you won't have to do anything. Most people who does not programming started with this.
1
u/TheBlackCat13 Aug 06 '19
You don't need to set up a workflow. You can just install anaconda and run Spyder and be in roughly the same place you are with MATLAB. All that other stuff is optional things you can use once you get more used to it that can make your life easier, but is 100% optional.
0
Aug 05 '19
[deleted]
2
u/Alexanderdaawesome Aug 05 '19
Dude, everyone has been awesome about these type of questions, even to that newb above. No one is actually shitting on MATLAB.
77
u/aaronr_90 Aug 05 '19
How would one convence their office that spending hundreds of thousands of dollars on matlab every year is ridiculous?
78
u/Deezl-Vegas Aug 06 '19
> spending hundreds of thousands of dollars
There you go buddy, write the email
18
16
7
u/okkshin Aug 05 '19
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.
6
u/Alexanderdaawesome Aug 05 '19
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?
5
u/okkshin Aug 05 '19
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.
2
u/Gabe_Isko Aug 06 '19
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.
→ More replies (2)3
u/tjl73 SymPy Aug 06 '19
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.
→ More replies (3)2
u/TheBlackCat13 Aug 06 '19
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.
→ More replies (2)2
u/TheBlackCat13 Aug 06 '19
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.
1
u/okkshin Aug 06 '19
Agreed! I'm a proponent for using the right language or tool for the right problem. Matlab OOP isn't exactly that tool for normal OOP, but say for interacting with other automotive code in Matlab it could be. Websites, not so much.
2
u/TheBlackCat13 Aug 06 '19
MATLAB OOP is a nightmare. A complete and utter nightmare. I just have no other way to describe it.
→ More replies (3)1
u/I_Feel_It_Too Aug 06 '19
The response to the top comment even claims people who like Matlab aren't in general programmers!
No, what it says is that anyone who says they like Matlab clearly hasn't had experience with other programming languages. Which is so obviously true that it isn't really worth saying outloud—except to someone who hasn't used anything other than Matlab, which seems to be the case here.
Matlab was not designed for general programming...
This was written for you. In particular:
<snip>
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. To borrow your analogy, it’s as though Microsoft were putting out promotional material showing all the newsletters and magazines people have laid out using Excel.
The second problem is that if you think of yourself as “not a programmer,” that actually doesn’t stop you from needing to write code. It might stop you from seeing that you need to write code. Which is a condition that infests a whole lot of people.
Your pitch here is really… strange. It reminds me of the curious phenomenon where textbooks pitched at college freshman are titled “X for Scientists and Engineers” and books with actual meat on their bones are more often titled “Introduction to X.” I mean here you come out purporting to be in defense of scientists and the only things you say about them are incredibly belittling! (I wonder if there is some personal insecurity and projection fueling this.) I think you are doing a disservice to scientists and engineers by both belittling their computational needs, and inflating the perceived difficulty of anything that might actually meet their needs.
<snip>
Matlab has an domain-intuitive design.
No, it really doesn't. Does your stats textbook use left-stochastic matrices? (You could use a right-stochastic matrix, except the performance hit is too severe for sparse matrices. Seriously.) Does any other numerical system you've encountered default to 16 bit arithmetic? Oh, here's a good one: what's your intuition for what the output of vpa(2305843009213693951) is?
You only think it's domain-intuitive because that's all you've ever used. But there are dozens of computing tools written for this domain that you have never used, so out of ignorance you think Matlab is somehow competitive. Which it definitely is not. These days, the best ones are even free!
It isn't elitist to say that Matlab is one of the worst possible tools for any given job. It's the opposite of elitist. It's democratizing. Pick nearly any other tool in the domain space and chances are it's better than Matlab. Have you ever used Julia? Python? R? Oh, I see you like to spend a lot of money. Have you tried Mathematica? At least if you used C++ or Rust you could write a descent data structure, manage memory, have predictable performance characteristics, and be able to hire cheap programming talent on UpWork whenever you wanted. But no, let's pretend that even if they were the only alternative the learning curve for those systems programming languages are so fucking steep that spending months or even years trying to work around Matlab's unique limitations is somehow worth it. Let's pretend that the licensing costs—before the costs of all of the toolboxes that provide the most basic functionality not included in Matlab proper that you need to do anything useful—aren't more than it would costs to hire an undergraduate to write all your code for you. It's a different pot of money, I suppose, so let's choose the worst, most expensive piece of shit software possible because we can't be bothered to learn anything else besides what we used in grad school. That isn't elitist, my friend. That's knowing my ass from a hole in the ground. It's that simple.
2
u/okkshin Aug 06 '19
I like how disagreeing with people here automatically makes you an "ignorant" shill of the evil MathWorks corporation.
Your first statement is ridiculous. Quite obviously, there are plenty of people with experience with other languages that find it useful and worthwhile. Throwing presumptuous insults doesn't exactly prove anything.
None of the options you mention are fit to replace Matlab in its entirety. What makes Matlab domain-intuitive isn't its default bit-system (which hasn't been 16 since, I'm not sure) or the actual programming language, but it's development system; toolboxes and graphics. Simulink, Control System, the PDE Toolbox, Simscape, et c., similarly to what makes python or any other languages great.
→ More replies (2)
28
u/random_cynic Aug 05 '19
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.
7
Aug 05 '19
Well, cares a little bit:
https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html
16
4
u/robberviet Aug 06 '19
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.
7
1
u/SonGokussj4 Aug 06 '19
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.
1
u/Alexanderdaawesome Aug 06 '19
Not versed in your field but I found this: https://readthedocs.org/projects/py-pol/downloads/pdf/latest/
3
u/xxBobaBrettxx Aug 05 '19
Out of curiosity, what's the general consensus on plot.ly?
3
u/Zizizizz Aug 05 '19
Really nice if you use the offline plots in my opinion but I don't like that online ones are published
1
u/PeugeotWaterface Aug 06 '19
I believe with 4.0 online plots are no longer automatically public. May want to double check but I'm fairly sure.
1
1
u/Gabe_Isko Aug 06 '19
Can confirm. They switched their business model to being g a service. Now everything that generates graphs is free and can be run locally. They will graph data assets for you on cloud though. It's pretty nifty - its gets lrettynresource intensive to visualize super large data sets.
1
u/Gabe_Isko Aug 06 '19
I like it a lot. Great for interactive graphs. Dash is pretty cool too. I also like their service business model that they pivoted too. I with they could do what they do with less complex dependencies, but that is somewhat of an unreasonable thing to expect.
1
u/throwawaydyingalone Aug 06 '19
Is it bad to want to learn both?
4
u/Alexanderdaawesome Aug 06 '19
is it bad to learn
bruh
1
u/throwawaydyingalone Aug 06 '19
Not saying it’s ever bad to learn in general but would employers look down on intermediate in both vs advanced in one?
1
u/Alexanderdaawesome Aug 06 '19
Depends on the employer. If you are going into software MATLAB is basically useless. Engineering in other forms not so much
1
u/throwawaydyingalone Aug 07 '19
I’m interested in Biotech and I’m able to access Matlab with the add-ons through my university. I definitely want to take advantage of that but I want to make a proper plan first.
1
u/Alexanderdaawesome Aug 07 '19
23 and me, as well as myriad genetics use python if that helps you make your decision.
→ More replies (2)
4
u/ASCIASCI Aug 05 '19
Just wait until someone asks you to do something in LabVIEW
1
u/jammin-john Aug 27 '19
I have actively avoided doing anything in LabVIEW, even if it means I have to install new drivers and wrote Python code from the ground up lol
2
3
u/porksmash Aug 06 '19
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.
3
u/tjl73 SymPy Aug 06 '19
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).
1
u/TheBlackCat13 Aug 06 '19
It would make a lot of sense for mathworks to really push these areas. Instead they are trying really hard to make MATLAB a general purpose programming language when it just isn't very good at it.
2
u/SKRyanrr Aug 05 '19
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!
2
1
u/Im_manuel_cunt Aug 05 '19
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?
2
u/I_Feel_It_Too Aug 07 '19
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.)
1
u/Vasault Aug 05 '19
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
1
1
1
1
1
u/pythoncrush Aug 22 '19
I am primarily a python developer but recently I did a project with an SDR called pluto that Matlab advertises as "fully supported ". This is from their website right now https://www.mathworks.com/hardware-support/adalm-pluto-radio.html
My needs were to design my own wifi signals with parameters in the headers I configured preferably with automation.
I requested a license for Matlab since nobody on my team has it we got a trial license for 90 days. I spoke to the rep on the phone and through email and he assured it was all very straightforward. Turns out he was complexly wrong. The rep simply sent us a trial Matlab license without the Pluto communications toolbox plugin. Without this plugin Matlab doesn't even recognize the Pluto sdr. So I request another trial license for the plugin. Install that and I take a look at their examples on how to use their language to generate wave forms, NONE of them work! I can't tell what's going on in the language the syntax sort of looks like C but looks like Scheme sometimes. Anyway hard for me to debug if some of the working code looks odd to me. Tic Toc was written by a person I never want to meet.
I ended up watching a YouTube video with an instructor for Matlab that was very helpful except none of the examples he is referring to in his presentation I had access to. I called Matlab and requested the examples and cited the instructor's name. They sent me the examples files and again most of them are broken as in don't actually work or error out. So I scheduled 3 conference calls, in the last one it involed the Matlab engineer debugging their own examples, apparently nobody ever tested with the Pluto device, many of the core libraries didn't recognize my device name, so I had no apis calls that had any effect. Toward the end of the project I discovered another completely different way to generate wave forms using an elaborate Matlab gui instead of using their silly ass programming language, as long as I had the raw I/Q data I didn't care it came from so we don't even mess with the language much anymore since our needs are so specific.
Python as far as I know didn't have anything working for the Analog device Pluto SDR so I have no choice. If there is one out there, please share it with me.
1
Aug 05 '19
Lady time I used Matlab (2014?) it could only use something like 2 GB of memory. That alone was enough to make me beg for a switch (which definitely wasn't going to happen).
1
u/Jesus_Harold_Christ Aug 05 '19
My favorite thing about matlab is that I haven’t had to use it in 20 years.
1
u/TracerBulletX Aug 06 '19
Just another dying legacy product from a bygone era, clinging to life through the nefarious reach of their large sales organization.
1
u/bronzewrath Aug 06 '19
I started using Python for not having matlab at office. Best change ever. But I still love matlab.
-2
Aug 05 '19
Some observations that are likely true on matlab users (based on my experience with past colleagues):
they do not think of using hash tables (or binary trees)
they do not think of dynamic arrays
they do not think of using regular expressions
they do not think of providing service over a network (TCP/IP)
I managed to convert some of them to python and some to julia.
426
u/Stereoisomer Aug 05 '19 edited Aug 05 '19
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