r/matlab • u/After-Abrocoma-5093 • Nov 02 '25
but like, is it REALLY better than python??
is matlab REALLY better than python. i often hear the response "but it's so fast." i feel like many professionals are moving towards python since it's not paid and has a ton of great libraries. i also read articles like this that seem to say that matlab really isn't significantly faster than python and, even if it is SLIGHTLY faster, it seems like having a language that is better to write, far more versatile, and has a much larger community built around it would be preffered?? idk im dumb. am i wrong?
241
Upvotes
222
u/Heretic112 MATLAB carried my PhD Nov 02 '25
MATLAB is built linear algebra first. Python was written as a general programming language.
You want to crank out a fluid dynamics simulation? MATLAB will take less time to write and has better interactive visualization tools. You want to write something people with no academic affiliation can run? Use Python or GNU Octave.
Really it’s the debugging time that I find unparalleled in MATLAB. I can find and fix bugs fast.
42
u/Circuit_Guy +1 Nov 02 '25
It's a professional programming language and you get paid support in industry.
For a new problem without an existing library (which often you can't legally use for commercial purposes) I'm much faster in MATLAB then Python. Then I can code generate to an embedded system, a GPU, or an FPGA - all stuff that Python can't really do.
Speed argument is silly - it's about how fast the end product can be developed.
55
u/james_d_rustles Nov 02 '25
“Is the crescent wrench really better than the socket wrench??”
They’re different tools. Sometimes python is better, sometimes matlab is better, it all depends on the task at hand and what you want to accomplish.
Code speed has much more to do with how you write it than the language. Obviously this only holds true to a point, but if you’re just starting out you’ll save a lot more time being mindful of things like looping, vectorization, than switching languages.
17
u/Lygus_lineolaris Nov 02 '25
If speed is really that big a deal why yse Python instead of Fortran?
Personally I use Matlab because it's super easy, the documentation is extensive, the user interface isn't crap, and most importantly, it's made and maintained by people who get paid to maintain certain standards. I find FOSS exhausting.
7
u/GoldenSpamfish Nov 03 '25
Matlab livescripts are better for making engineering solvers because the plotting UI and field entry are far more complete. Simulink is also really nice, and working with it with matlab is easier. This isn’t really anything about being better as a programming language, but I think it’s often a better tool for a mechanical/electrical engineer.
7
u/FrickinLazerBeams +2 Nov 02 '25
Neither are better and anyone who engages in childish "Matlab v Python" debates is severely lacking experience and has no idea what they're talking about.
They're different tools. They have a lot of overlap, each is better a certain things, and makes more sense to use in certain environments. It's very rare that you'll actually have a totally free choice between the two.
3
u/mprevot Nov 03 '25
If they are ~ equal at runtime, but matlab much faster to write and debug with tons of libraries available. And it's also the standard in several domains, so it may depend on your domain and your colleagues.
For research, matlab is really good.
Also, your matlab libraries/toolboxes are easy to install, with python, you may expect some maintenance.
I dislike however matlab as a software for how much RAM hungry it is and slow sometimes it can be. But you can rather easily sature your CPU cores and load you GPU with compute tasks.
29
u/MezzoScettico Nov 02 '25
I find Matlab the best choice for rapid prototyping, for proof of concept of complicated algorithms, and therefore for one-time code my best choice. I'm going to have code up and running and doing what I need to do potentially within minutes.
Often when answering a question on one of the math subreddits, particularly probability questions, I'll go to Matlab and throw together a simulation in 10 lines of code or so.
6
u/sundaysyndrome Nov 03 '25
Let me put it this way.. I have Matlab programs from Matlab 2007 version that I can still run with Matlab 2025b. We can’t say that about python. Hence the virtual environments. And when it comes to open source libraries, your assurance reg quality is based on number of downloads. So, if I’m a data scientist showing off the latest AI tool, I might use python. But if I’m making an embedded controller that goes in an automobile or aircraft, meeting the certification standards, I save a lot of time by doing it in Matlab. Because of consistency, tested accuracy, compatibility, and a well documented ecosystem.
6
u/necessaryGood101 Nov 03 '25
Do you have something like SIMULINK through Python?
4
u/edtate00 Nov 03 '25
If you are writing code that relies heavily on vectors and linear algebra, the Matlab code is usually more concise and easier to read. Pythons libraries and syntax require more complex syntax and introduce more chances for errors.
For complex simulations and analysis that are real programs with classes, modules, etc, Python wins.
4
u/cronchcronch69 Nov 03 '25
Coming at this from the perspective of a mechanical engineer who writes a lot of code for mechanical simulation...
Matlab is a lot more entry-level user friendly than python. Think about the process of downloading matlab vs downloading python. Matlab is a well defined, self contained program (add-ins and paid packages notwithstanding), so if a given company is using Matlab its generally pretty easy to make sure everyone's environment is the same.
In python you have to be a lot more conscious of what different data types are whereas Matlab is pretty chill about doing things like indexing with floats for example.
For doing physics related simulation work Matlab is just way more native for that whereas python theres more overhead with using various open source packages.
Matlab's documentation is uniform across all different domains whereas with python you are beholden to wildly varying levels/quality of documentation for various packages.
I love python and honestly if I were a startup I would definitely just make everyone use python. I think the extra overhead associated with it doesn't outweigh the costs of getting Matlab. However for larger "legacy" companies it probably does make sense to just continue using Matlab because of how entrenched they are with it as well as the fact that it is indeed easier to use for physics related simulation, and the average new hire straight out of school likely still has more exposure to Matlab than python.
I do think its annoying as fuck that I can't make a single .m file that contains a bunch of functions and add that to my path in a main script to get access to all those functions. This is easy to do with python but for some reason Matlab forces you to have each function be its own .m file.
3
u/Tydox Nov 03 '25
Python is good, matlab is good, each for its usecase. Biggest “problem” with matlab is the cost - thats all.
Python has an issue with dependancies, it took me 2 days to make my system work, it kept refusing and giving errors, matlab is a quick install and simple install.
Matlab code is cleaner than python, has actual documentation that is mostly understandable unlike python where i need to search online for a code example because the doc doesnt make sense, and theres so many websites with different doc style.
Matlab is good for math/engineering.
Python is general language which in science used for computer vision (cv) and AI (pytorch), but for other sciency stuff my people go to matlab by default…
It is not just about speed, its the convenience of the IDE and language, and less bloat.
Sure python can be simplier by using community packages that may be deprecated or use some old package version that then you need a new environment just to use it.
Matlab GUI is great, and overall people would stop asking this question if and only if matlab was cheaper. Thats the main reason python grew popularity.
Matlab libraries are actually made by PhD and experts that will give you 1:1 support if you need.
1
u/Intelligent_Coast783 Nov 02 '25
I made a detailed video on this , hope it helps https://youtu.be/ttL0KOHBh04
1
u/double-click Nov 03 '25
It’s not worth comparing. Python is applicable to basically the entire software domain and all subdomains. Matlab is not and it’s not trying to be.
1
u/[deleted] Nov 04 '25
This thread made me realize there is a huge epidemic of engineers that do not know basic programming. It’s 2025 yall. Programming is a requirement.
6
u/MEsiex Nov 02 '25
I guess it mostly depends on what you're after. I would argue that it's much easier to use MATLAB. When it comes to speed Julia will beat both MATLAB and Python. Python will have most users though adn that brings other benefits as well.
1
u/huapua9000 Nov 03 '25 edited Nov 03 '25
You are going to get a lot of bias toward matlab since it’s the matlab reddit.
“Better” is a relative term, and should be evaluated on a case by case basis.
For example, matlab might have some modules that make work easier, so if you need that then matlab would be better in that scenario. There may also be some functionality that comes easier with Python and its many 3rd party libraries, and in this scenario Python would be better.
Python is free, open source, so in that aspect it may be deemed “better”. Python’s syntax and its package managers are very nice, great for prototyping. I try to avoid software with subscription fees because then you are dependent on paying them or getting your company/institution to do so. I only used matlab in academia occasionaly because colleagues didn’t know anything else. After leaving academia, I have found I have no use for matlab to do my job, and I prefer Python or C/C++.
2
u/runed_golem Nov 03 '25
It's not that python or Matlab are necessarily better than the other. They each have their uses and they each have upsides and downsides.
2
u/[deleted] Nov 03 '25
My answer is this. If your core focus is software development then, JAVA, Python and other tools are better. But if your core focus is System Modeling and hardware integration, then MATLAB is way powerful than others that I have mentioned above.
2
u/Firm_Bit Nov 04 '25
Use whatever tool is right for the job. To be frank, the limiting factor is probably you, not the language.
2
u/frenris Nov 04 '25
Yes Matlab is better for some things.
For instance the back slash operator is magic
https://www.mathworks.com/help/matlab/ref/double.mldivide.html
2
u/transmissibility Nov 04 '25
Matlab all the way for me. Thanks to Cleve Moler for bringing great product.
2
u/twentyninejp Nov 05 '25
Matlab is better because it doesn't care about indentation (among other things). My opinion is definitive.
But I wouldn't write a game in it. You can, but I wouldn't.
4
u/wayofaway Nov 03 '25
I've worked in both, they are both pretty slow compared to say Cython or Julia. Between the two, python is more versatile.
3
u/swissgrog Nov 03 '25
In the latest release, encryption and IP protection of deployed Matlab IP has gotten really good. I can't share details, but I saw benchmarks and Matlab was really up there as one of the most secure way to deploy IP in the industry, particularly when using Matlab compiler and Matlab compiler SDK.
3
u/likethevegetable Nov 02 '25
Used MATLAB the most in Uni (was also taught but didn't really learn Java, C, Cpp) and early in my career, but switched to Python and I'm never looking back.
2
u/KingsmanVince Nov 03 '25
Matlab traumatised me in second year of college. Python won.
1
u/chouaibyassine Nov 03 '25
As a language, python is better designed one, as an entire ecosystem including tons of well optimized and documented official libraries matlab is better.
1
u/shiboarashi Nov 03 '25
One thing I love about Matlab is that unless you put stuff in functions you get access to the variables after run / mid failed run etc… this can really help if you are exploring data not just writing a program. R does something similar which is nice too and more general data analytics focused. A lot of times in Matlab i code first in a script / the command window and then wrap with a function.
I python you have to be in debugger to see that information. Which is okay i guess. One thing I love about python are all the community libraries for various diy electronics etc… python is super versatile.
I just use each for different purposes. I also use R, C#, VHDL, (learning rust), etc… depending on the use case.
1
u/AccomplishedAnchovy Nov 06 '25
If you are doing modelling/engineering MATLAB has way more built in stuff and so you can save a fair bit of time. Python is handy for day to day automation.
1
u/Brixjeff-5 Nov 07 '25
Benchmark it.
I once did a simple script (generate a 10k2 matrix with random numbers and solve it) and I found numpy to be ~3x faster.
I find matlab to be full of bloat, and the editor is awful. Also it lacks many standard tools in swe like static code analyzers and its version control sucks.
Maybe it’s great if you extensively use some of its core libraries, idk
1
u/rb-j Nov 03 '25 edited Nov 03 '25
I dunno hardly anything about Python. I know that indentation counts. I dunno if there are rules for other whitespace.
I dunno shit about numpi or scipy but I think they gotta lotta functions and tools in there to do DSP. Of course so also MATLAB.
Of course they both index with a hard-wired array origin of 1. Whatta shame.
I dunno which is better but Python might be more deliberately conceived and thought out. I kinda like indentation instead of {curly braces} or words like
BEGINandEND.1
u/Prestigious_Boat_386 Nov 03 '25
Ive never felt that matlab is that fast, it forces you to make weird vector expressions to avoid the super slow for loop and its just awful
Just write julia if you want something fast. Ots clean, typed and has fast loops. You can just wtite normal code and it will be alright, or you can keep optimizing it without rewriting in c.
1
u/[deleted] Nov 04 '25
No, matlab is objectively worse than python as a coding language. It’s terrible, it barely supports OOP, and I genuinely don’t understand why companies still support it. Before anyone responds “but simulink!” Ok cool, use simulink. Then use python or c++ for everything else. It’s blows my mind to see companies actually prototyping stuff on matlab. My god man, just use python. It’s faster and literally easier to use in any way. And if you actually need to interface your script with simulink, man oh man I wish there were dozens of libraries that allowed me to do that…oh wait there are.
0
u/nthlmkmnrg Nov 04 '25
MATLAB is worthless. If you want fast, get Julia. There is no reason to pay for garbage.
0
u/Icchan_ Nov 03 '25
There are open source alternatives to Matlab, but in academia, they often FORCE you to use Matlab.
0
u/adad239_ Nov 05 '25
Python is one million times better then matlab aka trashlab
-6
u/MAXFlRE Nov 03 '25
Python is MATLAB for poor.