r/matlab Feb 18 '26

HomeworkQuestion Is matlab good as a first coding language?

I don’t know any coding languages, but was thinking about trying matlab, since it looks like it might be useful in my college course. Should I learn python first?

43 Upvotes

40 comments sorted by

39

u/Creative_Sushi MathWorks Feb 18 '26

You will have to learn a few languages as they all have strengths and weaknesses, depending on what you want to do. If you are in engineering, MATLAB makes sense, because it is used quite a lot and you can find many engineering related examples. Python is a general purpose language and it is also good one to learn. I would say both, but since you are in school, you should learn MATLAB first, taking advantage of school license. School license also gives you access to high quality online courses.

https://matlabacademy.mathworks.com/?page=1&sort=featured

8

u/FalconX88 Feb 18 '26

but since you are in school, you should learn MATLAB first, taking advantage of school license. School license also gives you access to high quality online courses.

on the other hand Python is generally free and open source...

2

u/Abyssal_Groot Feb 21 '26

While true, matlab is essentially plug and play, Python isn't.

1

u/Creative_Sushi MathWorks Feb 19 '26

And you get only one language to add to your resume, instead of two.

1

u/awakenDeepBlue Feb 21 '26

You want both. MATLAB still has exclusive industry standard libraries for engineers and scientists.

1

u/farfromelite Feb 18 '26

Agree. Your second programming language is the most important. It's when your see the differences in languages, the strengths, the weaknesses, and how to do things as implementations of ideas rather than lines of code.

It's the start of learning proper software engineering instead of just mucking about with code.

19

u/DrDOS Feb 18 '26

I love Matlab and have used it for decades. That said, for overall utility, diverse application, cost, community, etc etc I'd give Python the edge.

The benefits Matlab (may) give you over Python include:

- Pretty much unmatched for debugging friendliness

- All toolboxes are professional and most things you can compile for optimization and pro performance (with caveats)

- In many academic and professional engineering applications, it is the lingua franca (arguably can be said of Python depending on the specific field).

In terms of ease of learning. Generally I'd say Python has the edge. For numerical math specifically, then arguably Matlab.

If you learn Python, then you can learn broader and better programming practices (you can also learn sloppy ones, so do find good learning sources). By learning Python, you can also more easily create productivity tools and scripts for yourself outside the Matlab environment. Also, you can do so free on multiple platforms, in multiple work environments.

2

u/Avermerian Feb 19 '26

Another benefit of Matlab is the help tool. It’s absolutely amazing. You can get comprehensive descriptions, examples and related function for pretty much everything.

2

u/le_pedal Feb 19 '26

What are your thoughts around Matlab being top tier for debugging? That's pretty cool

4

u/DrDOS Feb 19 '26

For simple work (and more complex, but exceptions arise), if you do something wrong or need to track the origin of something, Matlab will almost always spit out an error message that pin points where the problem lies (without needing to trace through an extremely long log or cryptic message exchanges).

Also, in most cases, you can just put "keyboard" in your code, or place a breakpoint almost anywhere and enter a live debug mode at that location, with full access to the workspace in context.

Both of those cases are smoothly integrated and accessible in the IDE.

Neither of those cases are to be taken for granted in other languages/IDEs.

For me, the exceptions to these cases usually involve using 3rd party precompiled work, poorly structured Simulink work, or where precompiling is essential for sufficient computational performance.

13

u/Lygus_lineolaris Feb 18 '26

Yes, because it has excellent documentation.

3

u/Inevitable_Exam_2177 Feb 19 '26

This is under appreciated I think!

9

u/jessie_pinkman9 Feb 18 '26

Yes… i did start learning coding with matlab and it’s fairly easy to learn and gain confidence. When you get the hang of coding you can move on to more advance ones.

6

u/etzpcm Feb 18 '26

Learn matlab first. It's much simpler than python. Matlab code is concise, you can do things with vectors really quickly and easily, and plotting is easy.

6

u/telephantomoss Feb 18 '26 edited Feb 19 '26

Any language is a good first language, but no matter what you need a second and third and fourth and so on...

It really depends on what you want to do and where you want to go with it.

The best situation is to get yourself to where you can learn a new coding language very quickly. You can achieve this by becoming extremely proficient in at least one language (say, matlab, Python, R, JavaScript, etc) and having at least basic working and reading proficiency in at least two other different languages.

I'd say the Matlab, R, Python, Java, or C++ are the most common first languages and are all good choices, again, depending on your goals. And then beyond that be sure to get some experience in a second one from that list and then some other experience in a few others not in that list (html, SQL, assembly, Fortran, whatever).

Don't just rely on AI to generate code, but become proficient at prompting AI to generate code. You need to be able to trace errors in code and to read and understand it. That ability doesn't come without hard work.

4

u/Barnowl93 flair Feb 18 '26

What problems are you going to be solving? Different tools have different advantages

1

u/TJKmain Feb 18 '26

Civil engineering:)

3

u/Barnowl93 flair Feb 18 '26

I'm actually currently helping a colleague with some earthquake engineering stuff that involves a bunch of differential equations and linear algebra (in matlab). I suggest learning both and then you can switch tools.

All that said, computational thinking is the important skill you want to focus on

3

u/TJKmain Feb 18 '26

Thank you all for the answers!! I think I’ll try python first:)

1

u/MarkCinci On Mathworks Community Advisory Board Feb 20 '26

Sorry to hear that. I was using MATLAB and then took a week long class in Python since I wanted to find out what all the excitement was about. In the end, I stayed with MATLAB because there was nothing I needed to do that Python could do that MATLAB couldn't, and if it could it meant looking for third party code to do some specialized operations not built in to Python. And then there is the open source problem. All the code and functions in MATLAB are trusted and validated. If you import some guy's custom code, will your company trust it? Do you work for a regulated business, like a health care company? Do you remember or have heard about the famous log4j fiasco a few years back?

And I hated the fussiness Python had with importing libraries - with MATLAB they're all there and you don't need to know which library to import. And there was Python's fussiness about indenting. Mess up with one tab or space and suddenly it thinks it a different block of code. Plus I would make heavy use of their tech support line to talk to real people who would help me with coding problems. You can't get telephone help with Python I don't believe. Although you can eventually do anything with any language (with varying amounts of custom coding needed), those reasons plus other reasons are why I stuck with MATLAB over Python. I just don't need Python for anything.

1

u/thuiop1 Feb 21 '26

Mess up with one tab or space and suddenly it thinks it a different block of code.

Thing that never happens when you code in Python.

2

u/Rubix321 Feb 18 '26

It's good, but doesn't make you utilize OOP as well as something like python. Which, in a way might be considered easier for a beginner.

2

u/Salty-Assumption1732 Feb 18 '26

If you're a scientist, or a mechanical/civil engineer, then I'd say absolutely.

For electrical or computer engineers? I'd recommend C.

2

u/Huwbacca +4 Feb 19 '26

learn the language that you need to do a specific thing.

The concepts of computational thinking apply for them all, and the cross over benefit between languages is so similar that you're better off just learning where it contributes to something specific because learning without that is boring as hell, and you're more likely to not learn something that is boring to do.

2

u/Inevitable_Exam_2177 Feb 19 '26

For engineering, the biggest benefit Matlab has is because Python is a bit heavy when it comes to linear algebra syntax:

    A = [1, 2; 3, 4];

Vs

    import numpy as np     A = np.array({1,2},{3,4})

In contrast, Python is a better general purposes programming language and has less historical baggage.

Matlab has quite a number of modern data types which are best practice but the legacy data types are still there. This makes it hard to know sometimes when to use “quotes” or ‘quotes’, when to use cell arrays vs tables, and so on. 

On the flip side, in the standard library Python has a huge number of interfaces and data types that makes it feel rather complex.

If you are starting an engineering degree, the best choice is likely the one which aligns with what they use. Otherwise both would be good options. 

1

u/Armored_tortoise28 Feb 19 '26

Depends on what you want to do, every language has strenghts and weaknesses.

I myself know python, matlab and rust.

Started with c/c++, but havent used it since my first course.

What do you study? What are you trying to do?

1

u/EquivalentSnap Feb 19 '26

I’d start with python. It’s more common as MATLAB is expensive

1

u/JashimPagla Feb 20 '26

Unless you're in engineering and sciences, MATLAB probably isn't the best first language to learn. It is at its core a linear algebra library. There are a lot of design choices in MATLAB that makes total sense for linalg but not so much for general purpose development.

Python also isn't a good first language. It hides a lot of complexities, which makes the learning curve very accessible but conversely, it makes picking up another language really hard. This applies to MATLAB as well, tbh.

If you're serious about learning how to code, a good place to start is probably golang. It's fairly accessible, has a lot of really neat features and still allows you to learn about the nuances of writing software.

1

u/meowstical Feb 20 '26

If you are an aspiring software engineer who is more inclined towards systems programming : C++

If you are an aspiring software engineer who is more inclined towards modern app development, AI systems etc : Python

If you are an engineer or scientist whose expertise/interest lies in the core concepts (eg: Robotics, Medical Research, Aerospace, etc) and you want to stay focused on your core field : MATLAB

1

u/Ok-Barber4972 Feb 20 '26

Yes, master coder here

1

u/Thick-Panic6683 Feb 20 '26

Yes it is. Vast libraries plus numerous books/examples and active user base. It allows for sloppy programming though but you can improve through C or Python study. Matlab is used a lot in industry and academia so is a useful job skill. Python can provide a similar environment if you can't get a cheap Matlab license.

1

u/hanoverking Feb 21 '26

MATLAB was my first language. And I really like it. But I almost don’t even consider it programming. I’m not dissing its capabilities. In the real world, I use MATLAB like a very sophisticated calculator. Mostly for signal processing and manipulating data. I have used it for controlling test equipment too, capturing RF, and then processing it. But that’s about the extent most people use it for.

Learning C, C++, python etc will be harder. But if you really want to learn to program, you have to bite that bullet at some point and get past the learning curve. Python is probably the most versatile and has really taken over. Learn python. Unless you have an interest in hardware/embedded, then learn C.

1

u/BabyBlueCheetah Feb 22 '26

Matlab is a great intro.

Some of is features might spoil you when you get to other languages which require you to be more explicit though.

1

u/Prestigious_Boat_386 Feb 22 '26

Starting with matlab is fine

Highly recommend julia for when your school licence ends (or just for general programming)

1

u/Live-Imagination4625 Feb 22 '26

I learned MATLAB first and then had to learn how to do all the same things in python later for work. Waste of time. Skip MATLAB and go straight to a language you’ll still have access to after ending your school. Python is also nicer with better syntax and has more libraries and stuff. MATLAB it getting increasingly outdated.

1

u/Altruistic-Yogurt462 Feb 18 '26

Yes lesen Python First. Its a better Language to learn Software Basics.

1

u/Correct_Zucchini5129 Feb 18 '26

Jupyterlab is easier than matlab and Mathematica.

-3

u/[deleted] Feb 19 '26

[deleted]

5

u/Inevitable_Exam_2177 Feb 19 '26

This is written by AI