# Help me get up to speed with Matlab.

May 23, 2007 8:31 AM Subscribe

What are the best online and offline learning materials for Matlab?

I'd love to see some online videos to get me past the interface, pick up a solid book on the topic and dive in. Free would be best, but paying for books or video training does not phase me, especially if the quality is very high.

I'll be using Matlab primarily for modeling and image processing, towards my PhD in Visual Neuroscience, if that helps anything. I've got little to no programming experience, beyond scripting in Alias Maya.

Also, are there online communities for Matlab like there are for 3D modeling packages/compositing/etc?

I'd love to see some online videos to get me past the interface, pick up a solid book on the topic and dive in. Free would be best, but paying for books or video training does not phase me, especially if the quality is very high.

I'll be using Matlab primarily for modeling and image processing, towards my PhD in Visual Neuroscience, if that helps anything. I've got little to no programming experience, beyond scripting in Alias Maya.

Also, are there online communities for Matlab like there are for 3D modeling packages/compositing/etc?

I found the in-program help/tutorial actually very helpful and thorough. I haven't found any other books specifically helpful, it is BASIC-level programming so everything is sort of intuitive if you have a grasp on discrete mathematics.

I really think the best thing may be (at least for me) is to just jump in and do what you want to do. It helps if you have a mathlab professor/grad assistant you can bounce things off of. I use matlab to analyze large matrices, not necessarily image processing, so that may make a huge difference -- I don't know.

posted by geoff. at 9:21 AM on May 23, 2007

I really think the best thing may be (at least for me) is to just jump in and do what you want to do. It helps if you have a mathlab professor/grad assistant you can bounce things off of. I use matlab to analyze large matrices, not necessarily image processing, so that may make a huge difference -- I don't know.

posted by geoff. at 9:21 AM on May 23, 2007

Best answer: My textbook was

Since you can enter commands directly into Matlab, it's easy to learn the programming end of things by trial and error before you start using scripts. Good luck!

posted by rossmik at 9:28 AM on May 23, 2007

*Introduction to Matlab*[pdf]. The later chapters are specific to Physics, but the first chapters are a good intro, and it's free online.Since you can enter commands directly into Matlab, it's easy to learn the programming end of things by trial and error before you start using scripts. Good luck!

posted by rossmik at 9:28 AM on May 23, 2007

Octave is a 'mostly compatible' open source clone of Matlab. They have plenty of free documentation for that so studying that could probably help with Matlab as well.

posted by PenDevil at 12:06 PM on May 23, 2007

posted by PenDevil at 12:06 PM on May 23, 2007

Best answer: Mastering Matlab is a great book for learning Matlab.

posted by achmorrison at 1:26 PM on May 23, 2007

posted by achmorrison at 1:26 PM on May 23, 2007

Best answer: Matlab books are, for the most part, a scam. They just regurgitate the already very excellent help. Make sure to use the help search feature a lot. For any even vaguelly menial algorithmic task, there is a function for it, or some neat way to use another function to get it done. Sometimes the names aren't obvious, so just keep searching for other options.

For functions you do know but want to use differently, just type 'help foo' where foo is the function. That documentation is extremely complete and rigorously precise.

For getting oer the "not having programmed much" issue, I'd recommend just trying things as much as possible. Start with small issues and work your way up. It's going to be really hard at first, but once you get over the initial hurdle you'll start to collect (and really understand) the building blocks of programs. The risk of just typing stuff in from a book is that you end up with little bits of code that sort of work and you spend your time plugging them together and getting confused about why they don't work. That said, everyone learns differently. This is how I learned, but you might be different.

Also! Really the best absolute resource is a local expert. Just sit and watch them write code and ask lots of questions. There's lots of learning that's hard to put in a book, but you'll pick up watching and asking. So I'd try to find that person as soon as possible. Online communities are an okay standin, but they just don't compare to the experience of having an expert around. There's gotta be someone at your institution who can fill that role.

posted by heresiarch at 8:29 PM on May 23, 2007

For functions you do know but want to use differently, just type 'help foo' where foo is the function. That documentation is extremely complete and rigorously precise.

For getting oer the "not having programmed much" issue, I'd recommend just trying things as much as possible. Start with small issues and work your way up. It's going to be really hard at first, but once you get over the initial hurdle you'll start to collect (and really understand) the building blocks of programs. The risk of just typing stuff in from a book is that you end up with little bits of code that sort of work and you spend your time plugging them together and getting confused about why they don't work. That said, everyone learns differently. This is how I learned, but you might be different.

Also! Really the best absolute resource is a local expert. Just sit and watch them write code and ask lots of questions. There's lots of learning that's hard to put in a book, but you'll pick up watching and asking. So I'd try to find that person as soon as possible. Online communities are an okay standin, but they just don't compare to the experience of having an expert around. There's gotta be someone at your institution who can fill that role.

posted by heresiarch at 8:29 PM on May 23, 2007

Best answer:

+++++++++++++++++++++++++++++++++++++++

- You can try Help -> Getting started in Matlab for an introduction.

- Matlab FileExchange has various community contributed libraries and functions, including many for image processing (and several specifically for biomedical applications). Look here before you try to re-invent the wheel.

http://www.mathworks.com/matlabcentral/fileexchange/loadCategory.do

- There is also some community contributed documentation (e.g . How tos and tutorials).

http://www.mathworks.com/matlabcentral/fileexchange/loadCategory.do?objectType=category&objectId=75

- In contrast to most other languages, the Matlab language encourages vector operations over iterative constructs (for-loops). In many cases using for-loops can be many orders of magnitude slower than the equivalent for-loops (Although in some cases for-loops are faster).

Here is a tutorial on how to write fast code:

http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=5685&objectType=file

- I suggest you learn how to generate plots programmatically (i.e. you learn the commands to set plot attributes and plotting). Generating plots by hand is time consuming and you do not want to have to repeat the task every time you run a new simulation. It will definitely save you time in the long run.

- The Matlab newsgroup has been indispensable to me. If you have a (non-beginner) question, search it, it has probably already been asked. http://groups.google.com/groups?group=comp.soft-sys.matlab

You can also post questions if you get stuck (Don't post beginner questions, things you should be able to find out easily on your own and definitely search your question on that group first).

- Learn to use the Matlab debugger. It is essential for troubleshooting your code.

- MLint can be helpful in pointing out errors in your code.

- The Profiler can be used to determine what parts of your code are taking up most of your program execution time (and therefore what you should spend time on optimizing if you need the code to run faster).

I've run into many things I despise about Matlab over the years. As a programming language I think it has many serious deficiencies (compared to other general purpose programming languages). It doesn't support multithreading (forget using multiple cores or multiple CPUs with Matlab). The fact that it automatically casts N-Dimensional arrays with trailing singleton dimension to a matrix is foolish. I've found Mathworks uneager to fix simple bugs. I could go on about many other "Why does it do that?!" examples. Despite it flaws Matlab is popular because of its high-level syntax, streamlined vector processing ability and plotting features.

Here are some other links that may (or may not) be useful to you

http://128.173.204.63/courses/matlab/matlab_tutorial.html

https://www.utexas.edu/its/rc/tutorials/matlab/

http://www.cs.ubc.ca/~murphyk/Software/matlab_tips.html

http://www.mathworks.com/matlabcentral/link_exchange/MATLAB/Tutorials/index.html

posted by fake at 10:25 AM on May 24, 2007 [3 favorites]

**Thanks everyone.**I also got this anonymous answer via email, which I thought was very well done.+++++++++++++++++++++++++++++++++++++++

- You can try Help -> Getting started in Matlab for an introduction.

- Matlab FileExchange has various community contributed libraries and functions, including many for image processing (and several specifically for biomedical applications). Look here before you try to re-invent the wheel.

http://www.mathworks.com/matlabcentral/fileexchange/loadCategory.do

- There is also some community contributed documentation (e.g . How tos and tutorials).

http://www.mathworks.com/matlabcentral/fileexchange/loadCategory.do?objectType=category&objectId=75

- In contrast to most other languages, the Matlab language encourages vector operations over iterative constructs (for-loops). In many cases using for-loops can be many orders of magnitude slower than the equivalent for-loops (Although in some cases for-loops are faster).

Here is a tutorial on how to write fast code:

http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=5685&objectType=file

- I suggest you learn how to generate plots programmatically (i.e. you learn the commands to set plot attributes and plotting). Generating plots by hand is time consuming and you do not want to have to repeat the task every time you run a new simulation. It will definitely save you time in the long run.

- The Matlab newsgroup has been indispensable to me. If you have a (non-beginner) question, search it, it has probably already been asked. http://groups.google.com/groups?group=comp.soft-sys.matlab

You can also post questions if you get stuck (Don't post beginner questions, things you should be able to find out easily on your own and definitely search your question on that group first).

- Learn to use the Matlab debugger. It is essential for troubleshooting your code.

- MLint can be helpful in pointing out errors in your code.

- The Profiler can be used to determine what parts of your code are taking up most of your program execution time (and therefore what you should spend time on optimizing if you need the code to run faster).

I've run into many things I despise about Matlab over the years. As a programming language I think it has many serious deficiencies (compared to other general purpose programming languages). It doesn't support multithreading (forget using multiple cores or multiple CPUs with Matlab). The fact that it automatically casts N-Dimensional arrays with trailing singleton dimension to a matrix is foolish. I've found Mathworks uneager to fix simple bugs. I could go on about many other "Why does it do that?!" examples. Despite it flaws Matlab is popular because of its high-level syntax, streamlined vector processing ability and plotting features.

Here are some other links that may (or may not) be useful to you

http://128.173.204.63/courses/matlab/matlab_tutorial.html

https://www.utexas.edu/its/rc/tutorials/matlab/

http://www.cs.ubc.ca/~murphyk/Software/matlab_tips.html

http://www.mathworks.com/matlabcentral/link_exchange/MATLAB/Tutorials/index.html

posted by fake at 10:25 AM on May 24, 2007 [3 favorites]

Just want to second heresiarch in saying that the built-in help and tutorial functions are fine. If you don't like using their help interface (and using Matlab for 2 years in Mac OSX's X11, let me say that if you're on a mac, you won't like it very much), all of the help is also on the web here.

I was in your situation, never having programmed before and needing to learn for MATLAB image processing, three summers ago, and while it's confusing at times, the step-by-step tutorials in the Matlab book that comes with the software (and also online, and built-in to the software) are great. As with almost any skill, though, the best learning resource is someone around you who you can ask even the dumbest questions, without feeling embarrassed or that you're unqualified for your job for needing to ask about basic programming skills.

posted by the_arbiter at 6:58 PM on May 24, 2007

I was in your situation, never having programmed before and needing to learn for MATLAB image processing, three summers ago, and while it's confusing at times, the step-by-step tutorials in the Matlab book that comes with the software (and also online, and built-in to the software) are great. As with almost any skill, though, the best learning resource is someone around you who you can ask even the dumbest questions, without feeling embarrassed or that you're unqualified for your job for needing to ask about basic programming skills.

posted by the_arbiter at 6:58 PM on May 24, 2007

This thread is closed to new comments.

posted by lunchbox at 8:53 AM on May 23, 2007