Help is no longer showing up for user written programs

Help is no longer showing up for user written programs. For example using the function addme as described in matlabs documentation on "Add Help to Prgorams" this is what whos up in command window
>> help addme
addme is a function.
c = addme(a, b)
Below is actual program file:
function c = addme(a,b)
% ADDME Add two values together.
% C = ADDME(A) adds A to itself.
%
% C = ADDME(A,B) adds A and B together.
%
% See also SUM, PLUS.
switch nargin
case 2
c = a + b;
case 1
c = a + a;
otherwise
c = 0;
end
Documentation says that this is what should appear in command window:
When you type help addme at the command line, the help text displays in the Command Window:
addme Add two values together.
C = addme(A) adds A to itself.
C = addme(A,B) adds A and B together.
See also sum, plus.
Using Matlab version 2023b. This problem just started happening. Always worked properly before.

9 Comments

Hey @Kevin,
I attempted to reproduce the issue you mentioned, but everything seems to be working as intended on my end. Could you provide the exact steps you followed, along with the output of the following command:
version
>> version
ans =
'23.2.0.2391609 (R2023b) Update 2'
exact steps are as above but here is recap.
I tried get help for one of my scripts and all it came back with was the function name and the function line from the script.
help xxx returned xxx is a function, function z = xxx(y).
Looked up documentation on how to add help to program and creatd m file of the example in the documentation and the results I got trying to use help are show in original question description.
Can you attach the exact addme.m file that you asked for help on and got just the "addme is a function" text to your question? I want to make sure there's nothing unusual about that file that might not show up with just the copied and pasted text.
FWIW, it works fine here in Answers.
type addme.m
function c = addme(a,b) % ADDME Add two values together. % C = ADDME(A) adds A to itself. % % C = ADDME(A,B) adds A and B together. % % See also SUM, PLUS. switch nargin case 2 c = a + b; case 1 c = a + a; otherwise c = 0; end
help addme
ADDME Add two values together. C = ADDME(A) adds A to itself. C = ADDME(A,B) adds A and B together. See also SUM, PLUS.
Let's make sure you're calling the help.m function that's part of MATLAB. What does this command show when you run it on your machine?
which -all help
/MATLAB/toolbox/matlab/helptools/help.m
which -all help
/Applications/MATLAB_R2023b.app/toolbox/matlab/helptools/help.m
/Applications/MATLAB_R2023b.app/toolbox/rptgenext/rptgenext/@RptgenSL/help.p % RptgenSL method
What if you expressly run help.m? Maybe the RptgenSL p file is getting in the way???
help addme won't be affected by the method on RptgenSL objects as 'addme' is not one of those objects.
To check this you can pass the command form of the help call into which as text and which will tell you what function will be called:
which help('addme')
/MATLAB/toolbox/matlab/helptools/help.m
If MATLAB were going to call an object method, it would list that method.
x = sym('x'); % sym object
which plus(x, 1) % what gets called for x+1? The plus method for sym objects
/MATLAB/toolbox/symbolic/symbolic/@sym/plus.m % sym method

Sign in to comment.

Answers (1)

Hi @Kevin,
I was not able to reproduce the issue on my end, but I did notice that the issue you are facing could be caused by having two addme.m files with the one having the description being shadowed by the file not having it.
You can check which addme.m is being used by using the following command:
which -all addme
See if this helps you.

Categories

Find more on Function Creation in Help Center and File Exchange

Products

Release

R2023b

Tags

Asked:

on 21 Nov 2024

Answered:

on 28 Nov 2024

Community Treasure Hunt

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

Start Hunting!