Wheres the best place to learn Matlab syntax?

I'm coming from java and everything is so close and I can see what im doing wrong but im not quite sure on little things like trying to express a variable in a fprintf situation. For example: x = 43.5; fprintf('there are x bananas in the crate');
I cant seem to find an easy place to answer simple syntax questions like these

Answers (1)

Stephen23
Stephen23 on 9 Sep 2015
Edited: Stephen23 on 9 Sep 2015
MATLAB has one thing that very few programming languages have: readable, accessible and helpful documentation, complete with working examples for you to try. MATLAB has by far the most readable documentation of any language that I know, all in one location. Because the online documentation is indexed by every internet search engine finding articles and function help pages is very simple (don't bother with the inbuilt search function). MATLAB/TMW also provides lots of articles on useful topics such as floating point variables, code vectorization, array indexing, how to preallocate arrays, how to write fast code, and a thousand other things that beginners should know about...
Yet for some reason those very same beginners seem to be allergic to reading/searching the documentation, so they avoid the one source that is readable, comes complete with examples and tips, and gives the definitive advice on using MATLAB.
Half of the questions that we answer here on MATLAB Answers are basically resolved by simply pointing the OP to the documentation of the function that they are already using and quoting part of that documentation to them. It is usually clear that they did not bother to read it themselves. Although on first glance there can be a lot of information on the page it is worth reading through and finding what you need!
And now for some practical advice: because good MATLAB code does many things quite differently to Java, C, etc, it would be worth doing these tutorials:
In particular pay attention to code vectorization and indexing, which are very different to low-level languages. Some other advice on learning how to think in MATLAB-code:

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Asked:

on 9 Sep 2015

Edited:

on 9 Sep 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!