Getting Help in MATLAB

The functions doc and help provide help in MATLAB.


doc opens the Help Browser, and doc name displays in the Help Browser the documentation for the functionality name. In most cases, name refers to a function, class, keyword, or script file.

% Open the Help Browser
% Help documentation for the 'rand' function
doc rand;
% Help documentation for the 'if' keyword
doc if;


help works similar to doc, but it displays the documentation directly in the Command Window and in a compact format.

% List all primary help topics
% Help text for the 'rand' function
help rand;
% Help text for the 'if' keyword
help if;
Use help to know quickly what a functionality does, and doc to make an in-depth study of the functionality.

Further reading

I recommend the following books to learn more on how to get help in MATLAB:

  1. MATLAB: A Practical Introduction to Programming and Problem Solving (4th Edition)

    This book was the winner of a 2017 Textbook Excellence Award. The first chapter explains how to get help in MATLAB, among other introductory topics like operators, random numbers generation, and trigonometry.

  2. MATLAB for Engineers (5th Edition)

    This excellent book is especially oriented to engineers and scientists who want to learn MATLAB programming. The third chapter explains how to use the help feature, and several built-in functions for elementary math, trigonometry, random numbers, and complex numbers.

I also recommend the following pages in the MATLAB help documentation, and the other tutorials in this series.

doc doc;
doc help;

Source code

I hope you have learned how to get help in MATLAB. The source code developed in this tutorial is available at this page.


Your friends may need this knowledge to complete a task. Share this tutorial.