How can you send an argument to the help function?
I wish to have something like this:
function intro(funcname)
disp('This is an introduction to the function you chose. See the help below:')
help funcname
end
where I can show the help text for a function, which name comes as an argument in the function. The above does not work though, when MatLab just searches for funcname as a function name and not the variable value.
In short: Yes, you can do it, by using the function form of
help:In your example:
Explanation:
The form that you are using
is merely a shortcut to:
If you have multiple arguments separated by space (Thanks to @Amro on this one), it is the same like sending multiple arguments:
For example:
is equal to
As a side note that represents my opinion, I would like to add that in general, the second form is preferred, except when you write a quick-and-dirty code.