Skip to main content


Between #Matlab and #Python, which one would you recommend to learn, for a student who wants to learn programming (from scratch) to do data analysis? And why?

I am conflicted because I think Matlab is maybe slightly more straightforward to learn, but Python should be more useful in the long term (I know both and need to decide which one to teach my student).

I think answers might differ depending on whether you're in academia or not so I'm also asking about your occupation in the poll:

#Academia #AcademicChatter #Coding #Programming #Neuroscience (in this case)

  • I recommend Matlab (as an academic) (1%, 3 votes)
  • I recommend Python (as an academic) (54%, 90 votes)
  • I recommend Matlab (as a non-academic) (0%, 1 vote)
  • I recommend Python (as a non-academic) (38%, 63 votes)
  • don't know / see results (4%, 7 votes)
164 voters. Poll end: in 1 day

This entry was edited (1 day ago)
in reply to El Duvelle

Matlab is proprietary and requires a license, you may learn it but when you leave a place where they provide you with a license you will have to fork out for that yourself.

Python, R, Julia and many others (even the classic UNIX tools) are all Free Open Source Software that you can learn and take the knowledge with you anywhere, knowing that you will be able to use the tools in any setting.

in reply to Pozorvlak

@pozorvlak Ta, I was vaguely aware there was a GNU version but couldn't remember its name.

If not all libraries/packages are supported though then that is a potential risk.

I started with Stata many years ago and liked it but moved to R for the more open-source nature and not having to buy licenses.

This entry was edited (1 day ago)
in reply to Neil

@nshephard @pozorvlak

Yes.. I tried to use Octave some time ago and it was not ideal, it had some problems compared to Matlab. But maybe that's improved now?

This is a bit out of topic but can you do the same things in R as with Python? I thought it was just specific to statistics.

in reply to El Duvelle

@pozorvlak Python v R, depends what you want to do but most things can be achieved in both.

Start with one and if you need something in the other learn that.

You can call Python functions from R using the `reticulate` package if rstudio.github.io/reticulate/ and you can call R from Python using `rpy2` rpy2.github.io/doc/latest/html…

Understand you won't ever know everything about either (or any) language and see it from the perspective as a journey of continual learning and you'll go far.

in reply to Neil

@pozorvlak R probably has more breadth in specific statistical modelling, it tends to be favoured by Statisticians, whilst Python is a more general language and tends to be favoured by those with Computer Science background.

Both are great and have supportive communities.

This is a good community dslc.io

in reply to Neil

@pozorvlak One more thought from me..

You'll need a tool to learn your programming in, again avoid proprietary tools (e.g. VSCode, PyCharm).

My recommendation would be to learn #Emacs, its FOSS, has a great user community and is endlessly configurable to suit your needs (beware the 🐰 🕳️ ) but it has the potential to massively improve your productivity.

in reply to Neil

@nshephard VSCode is open-source under the MIT licence. It's less customisable than Emacs, but probably much easier to get started with since it matches modern UI conventions. I use it as my main IDE.
@Neil
in reply to Pozorvlak

@pozorvlak @nshephard
Hmm, in that case I'm thinking more of Spyder or an equivalent (for Python). The Matlab IDE is great (easy to use, convenient for debugging) so something that looks as similar to that would be ideal. We want to have the least possible friction so that the student can focus on the programming language.
in reply to El Duvelle

minimal friction is a good, can't speak for Spyder as I've never used it.

However, we do learn when there is friction, its why using LLMs to solve programming problems means we don't learn. Depends how much time the student has to go up that learning curve.

Couple of decent things I read on this recently...

datavizf25.classes.andrewheiss…
skybert.net/aifail/dont-fear-t…

in reply to El Duvelle

It depends on your projects, really.

If you have to build upon or maintain existing (Matlab) code, then you don't have a choice.
Matlab is a commercial product and you have to buy a license to be able to even run or compile your code.

If you want to learn programming with a new project, Python is a good choice.
Python is open-source and always free and evolving. Code is backwards compatible and easy to run.

in reply to Christian Rickert

@christianrickert True, and in this case we do not particularly need to rely on existing code so Python might seem the most appropriate.

However, I have had very bad experiences with python code becoming broken due to not having the exact version of some dependencies, even Spyder not working because I had to use specific versions of some of its dependencies because the code needs a specific version. Some Python code I'm using at the moment is currently stuck in the past because I know that if I update one module everything will break..
So I am not sure we can say that Python is really backwards-compatible. I think Matlab actually deals with this a bit better...

in reply to El Duvelle

Python is moving quickly into "containerizing" with environments.

All my projects use `venv` or `uv` to create independent installations with different Python and package versions.

Under macOS you can use Homebrew, with Linux the package manager, and Windows just got `py` (install Python3.14 via `winget`) to manage Python versions.

in reply to Christian Rickert

@christianrickert I used to use conda (anaconda?) env for this. Is that not a thing anymore? I thing it works regardless of platform no?
in reply to El Duvelle

anaconda changed their licensing terms significantly: any (unlicensed) use of their proprietary components in any work context can incur hefty fines - at this point, just stay away from *conda
in reply to Christian Rickert

One more comment on the learning aspect:

Start with a simple text editor with syntax highlighting. If something breaks, you can ask an LLM of your choice how to fix it - you'll learn quickly.

If you use an IDE with AI code autocomplete, your code might eventually work - but you'll not understand how or why.

in reply to El Duvelle

Use it when you get stuck - LLMs are great to "reason" (within limitations).
You can always ask for a link to the documentation!
in reply to Christian Rickert

@christianrickert
Hmm, I don't see the point of using an entire LLM program (which is bad both environmentally and ethically) just to ask for a link to the documentation that you could get by... going to the documentation?
in reply to El Duvelle

Python is a much nicer and less weird language, so it should be easier to transfer concepts to other languages you pick up in future. It's also useful for many things other than data analysis.
in reply to Pozorvlak

@pozorvlak
Can I ask what you find weird in Matlab compared to Python? I used to think that Python was more intuitive, but then I had to do some more Matlab for a while and now I find it more difficult to code in Python. So I think a lot of the 'intuitive' aspect is just due to our own experience..

I guess for object-oriented programming Python is better (although Matlab can do it to some extent)? But these considerations are probably not relevant in this case where the student will (for now) do quite basic programming...

in reply to El Duvelle

the "functions live in files with the same name as the function, and can only export one function per file" thing is my major WTF - if I remember correctly, it means that the effect of a function call can depend on the *current working directory*? That's horrible.
in reply to Pozorvlak

@pozorvlak Hmm, I don't think the functions' output depends on the current working directory, all variables that are inside the function have to be provided as an input to it so I'm not sure how that would work..
in reply to El Duvelle

no, *which function gets called* depends on the current working directory, because it looks for the function definition in a file of the same name in the CWD. I've just tested this!
in reply to Pozorvlak

@pozorvlak oh yes, that's a thing. To avoid confusion in Matlab I use "favourites" which allow you to add selected folders to the path, I have a different favourite per project, and yes any function that your code uses will have to be from these folders, or Matlab's own functions, or the current directory.
I don't find it to be a problem personally but it's probably confusing if you're not aware of it in the first place!
in reply to El Duvelle

> who wants to learn programming (from scratch) to do data analysis

I think Python (and also R and Julia) is much more prevalent in the data science field than Matlab. There are certain engineering and applied math field, where Matlab probably still provide an ecosystem advantage, but I don't think data science is one of them.

Besides, Matlab is also not great on a lot of fronts. Being a proprietary language that requires a license is one, and its poor language design is another.

in reply to Lesley Lai

@lesley Definitely, the proprietary aspect is not great.

Why do you think it has poor language design, and does that have any influence on an average user? Having tried both I find some things to be annoying with both Python or Matlab..

in reply to El Duvelle

I haven't used it for a long time so I forget a lot details, but I still remember it have ambiguous syntax (so something looks the same can mean completely different things depending on context) and there are some weird limitations (e.g. one function per files).
in reply to Lesley Lai

@lesley I agree some of these things can be annoying if you're not used to it, and I hated the function limitation too when I moved from Python to Matlab. Now I find having multiple functions in a file messy 😂
in reply to janet (she/her)

re: there is another

Sensitive content

in reply to El Duvelle

I think Matlab has some uses for universities and companies that have it and pay for it and it's specialized packages, but for general purpose an open-source programming language (like python) is better. To learn, I would do python in jupyter and can learn and use other kernels with it.
in reply to El Duvelle

Programming? Python. Matlab is a complete language with a rich environment, but in some ways it's more designed like a maths software than a general purpose language. Things like basic algorithms and data structure can surely be taught and learnt decently using both, but if the goal is to learn programming in general, starting with Python will open infinitely more doors, and avoid a few of Matlab's limitations, quirks and bad habits (stuff like indexing starting with 1, etc.).

Besides, Matlab is on a downwards slope and has been for a while, even for its "traditional" uses. Even when I was in academia a few years ago, I sometimes had to work with Matlab, but it was either 1) large legacy projects everyone wished were rewritten in something else (often Python) but nobody had the ressources to or 2) the work of someone - generally not a computer scientist - who only knew Matlab. I can't recall anybody actually starting to create something and deliberately choose to use Matlab over other possible options.

in reply to El Duvelle

my university used Matlab for programming intro courses 20 years ago. Ten years later, I was asked by my former professor: they where then considering switching to Python. I recommended so for a number of reasons, and happily they made the sane choice.
in reply to Atle 🧇🧅

the reasons?

1. Open vs proprietary
2. Ease of installation
3. Usefulness in the broader world
4. Matlab beeing quirky (1-indexed)
5. Availability of learning resources

in reply to Atle 🧇🧅

@atlefren thanks for the input!

I'll play devil's advocate a little bit, I agree with most of your points except the install: Matlab just works, Python requires you to choose an IDE and install that separately (unless you want to use IDLE which is quite limited) + installing python modules & keeping all versions compatible between them can be a mess.

Also, in terms of learning resources, Matlab has great courses (e.g. here) , and there is a specific "Matlab for Neuroscientists" book that we give to all students. For python, there are actually so many tutorials out there that it is difficult to know which one to use..

in reply to El Duvelle

it might be that the Matlab install has improved over the last 20 years. But nevertheless, point 1 is the main one.

Should a university provide a course in how to use a commercial product, or should they teach programming concepts using an open language?

in reply to Atle 🧇🧅

@atlefren yeah, I am actually disappointed more and more every day with the role of universities in this. In my (UK) university, all the computers are Windows, we are basically forced to use Teams, One Drive, Outlook and the office suite, EndNote as a reference manager.. ALL proprietary & expensive tools. Try to install Linux and our IT is in panic.
On the plus side, some of the psychology researchers use R so not all hope is lost..

I guess playing my part and teaching Python to my students would be a positive step forward in this giant mess..

in reply to El Duvelle

@atlefren As for the installation: I can assure you that Matlab still doesn't just run on every non-windows machines. Had to fix some shared object files at least twice in the last two years.
Being able to choose an IDE and not having to use the default Matlab IDE is a pro, not a con, in my opinion. Just tell your students to use VS code (some FOSS purist will disagree, but your project is about teaching not license philosophy). Use venvs, and maybe even uv, then all will be fine.
in reply to El Duvelle

I a neither a data scientist nor an academic but I think you can look up Anaconda to see examples of how data scientists use python.
in reply to 🇨🇦

@notveryhandsome Yes, I've used #Anaconda in the past and it was doing the job, although it was a bit bulky and I had sometimes problems when updating modules... Just checked again, it seems they have now added an "AI assistant" to it... so I'll probably look for something else this time.

source: anaconda.com/pricing

in reply to El Duvelle

Python because it's more versatile, there are more library for everything I think. Plus it's free, I used to do image processing with Matlab with the license from my school but know I have no license anymore and I don't want to buy one just to try something twice or thrice a year. (I'm not an academic, I develop software in C++ for a private company)
in reply to El Duvelle

I used MatLab at university and even wrote my dissertation project in it. In the 20 years since I've graduated I've not used it once. I've used R a bit, but mostly Python for my Data Analyst and Data Science jobs, in an engineering field.

My employer does have MatLab, but I think they're moving away from it, mostly because the licensing and version management (and the licensing of the different versions) is difficult and expensive. I've certainly not seen anyone start any projects in the last ten years with it.

Python versioning and environments is a bit of a pain, and I believe R is somewhat better, but tools like UV are making it better. If you're just starting out and using just the (many!) standard modules that come with Python, you can leave worrying about version management of external dependencies a little later.

I think for many businesses the MatLab simulation modules and extras are quite useful, especially if you're a smaller business, as they can be very industry specific and specialised - but cost extra again, and can get pretty expensive.

in reply to El Duvelle

UV is a recent tool for managing Python packages, environments etc. it's made some serious improvements on a lot of the historic complaints people have had about Python version and package management.
docs.astral.sh/uv/

But I wouldn't worry about that if you're just starting, Python comes with a large built-in collection of packages that is more than enough for learning the ropes.

in reply to Henry

@hl thanks!
Well, my student is starting but I've been using Python on / off for decades now, so knowing what are the currently preferred tools for it is always good :)
in reply to El Duvelle

As an academic I recommend Julia. It is a super nice to write language with a great package manager (this really matters!). Add to this Makie for a great plotting experience.

TBH you will probably need some Python experience at some point because it is so common.

in reply to El Duvelle

I answered Python (as an academic-ish), but I think the more nuanced answer is it depends on a) what they're trying to do, b) what their longer-term career goals are c) what additional training resources are available (e.g., does everyone else use Matlab so they'd have lots of teachers/peers for that versus only you for Python, or vice versa). Matlab encourages lots of bad programming practices which can lead to more pain later, but Python has a much more difficult learning curve for setting up and maintaining a working environment. I've gone back and forth on which I think is better to recommend to students, and at the moment I don't think there's necessarily a one-size-fits-all answer.
in reply to El Duvelle

Matlab was actually my very first language. I haven't used it since I left academia though, whereas I've become a Python expert.

Packaging/install is absolutely the achilles heel of Python but it's otherwise a fantastic language and I think it's worth pushing through setup struggles. I also think the reach and community of Python both within and outside academia dwarfs Matlab and makes it the better choice even if the language itself is better to learn (a big 'if')

in reply to El Duvelle

Matlab: better for numerical analysis, data handling etc.
Python: Not as good at the above (although still very useful), but with far broader applications.

If it's their first go at programming, Python, it's more widely applicable and it'll be easier to get to grips with Matlab if they know Python, rather than Python if they know Matlab.

in reply to El Duvelle

In academia, started with MATLAB, the advantages of MATLAB being faster to start up with puts you ahead for maybe one week and then behind for the rest of time. The language encourages bad programming practices and much of what you will learn will not be transferrable to other languages. Your student will likely also not be able to even use the language if they leave academia.
in reply to El Duvelle

I see a lot of replies from people who left academia a while ago, and haven't used Matlab since. That's a very valuable perspective, but from an academic standpoint, Matlab still has real value (I say that using Python every day myself). In academic research, learning to look at, explore and understand your data is crucial. Learning to program is not - it's useful, but ultimately a different career path. For the type of data analysis I just described, Matlab often wins hands down over Python:
* Intuitive interface, all integrated (files, terminal editor)
* No need for virtual environments
* No juggling package versions that conflict and break
* Debugging works right off the bat. You can put a breakpoint in a code file at any time, even calling that function from the terminal and it works
* Figures are natively interactive. You can easily plot additional data, look at values.
* Data values are all easily accessed and displayed
And I could go on.
Python is great for many things, but not just for quickly understanding and analyzing data.
in reply to Vincent Prevosto

@100vint
Agreed! Maybe with the right IDE we can have most of these things in Python too?
in reply to El Duvelle

@100vint yes, pycharm pro w/ the R plugin is what we use

jetbrains.com/pycharm/

plugins.jetbrains.com/plugin/6…

in reply to Raptor

@raptor85 @100vint
Ugh, why do they have to put an "AI-assistant" everywhere these days?? Do you have the option to deactivate this in Pycharm?
in reply to El Duvelle

@100vint I don't have the latest build but in previous ones its just a checkbox to enable or disable (it runs as an addon/plugin)
in reply to El Duvelle

Academia viewpoint here:
Go the python way.

Its also easy to learn and your students will benefit on the long run.

Had to use Matlab during study, but could never re-use it afterwards.
Self-trained python and use it now for a lot of things.
Data analysis, data visualisation.

I even created a package (qrcite) to automatically generate qr codes for a set of references, to use them in my presentation.

in reply to El Duvelle

thanks.

Yes, I think this is the way to go. People, will make photos of your slides anyway. So you can let them access your references (and your papers) more easily.

in reply to El Duvelle

I used to be an academic but currently am not, so I voted as a non-academic, but idk 🤷

Anyway, I am definitely on the Python side because it's so much more widely used and easier to extend with packages. Plus it can do so much more than just numerical analysis. Almost every time I used Matlab in my days as an academic, I wished I could be using Python instead. It is true that Python can be less convenient, but I think the flexibility makes it worthwhile, and it's really not much more difficult if you learn how to work with it properly.

I would probably recommend Jupyter Lab as a frontend. Specifically: make a virtual environment (perhaps with pipx or uvx), install jupyter, install the extension that lets you pip install packages from within the Jupyter web UI, and that's all the messing around with venvs and CLI commands that you need to get started.