Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: commentary help lines

Subject: commentary help lines

From: Norman

Date: 13 Jun, 2008 08:13:01

Message: 1 of 22

Hi!

I have many matlab files with comment lines at the
beginning. With the syntax 'help <m_file>' you get these
comment lines. This is all well known of course, but I have
some files which seem to be coded in the same way but which
does not give any help when 'evoked' as above. Only a 'No
help comments found in <m_file>.' comes up. Any idea how to
change this behaviour?

Subject: Re: commentary help lines

From: Jos

Date: 13 Jun, 2008 08:37:02

Message: 2 of 22

"Norman " <norman.nospam.violet@tu-berlin.de> wrote in
message <g2ta6d$ni9$1@fred.mathworks.com>...
> Hi!
>
> I have many matlab files with comment lines at the
> beginning. With the syntax 'help <m_file>' you get these
> comment lines. This is all well known of course, but I have
> some files which seem to be coded in the same way but which
> does not give any help when 'evoked' as above. Only a 'No
> help comments found in <m_file>.' comes up. Any idea how to
> change this behaviour?

edit the m-file

jos

Subject: Re: commentary help lines

From: Norman

Date: 13 Jun, 2008 09:08:02

Message: 3 of 22

"Jos " <DELjos@jasenDEL.nl> wrote:
> > Any idea how to change this behaviour?
>
> edit the m-file

Well, I just added those comment lines this morning ... and
it still does not work. I even restarted Matlab (2007b) to
force to update its path and file informations without
success, and changing into the folder of the file doesn't
help either.

I have written many m-files where it does work, but I have
encountered some, like the one this morning, where it does
not work. Is there any other undocumented condition for the
comment lines which must be fulfilled to be accepted as help
documentation? I know only that the lines in question must
be in the first, continous block of comment lines in the
file. E.g:
function exit = foo(argument_one, varargin)
% This shall be shown if 'help foo' is entered
% in the command window

Norman

Subject: Re: commentary help lines

From: Jos

Date: 13 Jun, 2008 09:32:01

Message: 4 of 22

"Norman " <norman.nospam.violet@tu-berlin.de> wrote in
message <g2tddi$1g3$1@fred.mathworks.com>...
> "Jos " <DELjos@jasenDEL.nl> wrote:
> > > Any idea how to change this behaviour?
> >
> > edit the m-file
>
> Well, I just added those comment lines this morning ... and
> it still does not work. I even restarted Matlab (2007b) to
> force to update its path and file informations without
> success, and changing into the folder of the file doesn't
> help either.
>
> I have written many m-files where it does work, but I have
> encountered some, like the one this morning, where it does
> not work. Is there any other undocumented condition for the
> comment lines which must be fulfilled to be accepted as help
> documentation? I know only that the lines in question must
> be in the first, continous block of comment lines in the
> file. E.g:
> function exit = foo(argument_one, varargin)
> % This shall be shown if 'help foo' is entered
> % in the command window
>
> Norman


Strange. Check if

1) the help format is still wrong.
2) you've edited the wrong file. Note that there can be
multiple files with the same name on your matlab-path. What
does:

  which mymfile -all

give you?

hth
Jos

Subject: Re: commentary help lines

From: Norman

Date: 13 Jun, 2008 10:45:03

Message: 5 of 22

"Jos " <DELjos@jasenDEL.nl> wrote

> Strange. Check if
>
> 1) the help format is still wrong.
> 2) you've edited the wrong file. Note that there can be
> multiple files with the same name on your matlab-path. What
> does:
>
> which mymfile -all
>
> give you?

Weired .... I did nothing, but restarted Matlab again, now
the help functionality is there (and, to answer your 2nd
question; yes there's only one file with that name).

Hey, I think I got it, well, partly: Sometimes you need to
give the m-filename including the '.m', sometimes not.

Subject: Re: commentary help lines

From: us

Date: 13 Jun, 2008 10:58:02

Message: 6 of 22

"Norman ":
<SNIP strange help-problems...

> Hey, I think I got it, well, partly: Sometimes you need to
> give the m-filename including the '.m', sometimes not...

this may happen if your files reside on a server;

     help rehash;

could give some insights...
also, i've never encountered a situation where help only
worked with the .m extension(?)... can you show an
example...

us

Subject: Re: commentary help lines

From: Norman

Date: 13 Jun, 2008 11:16:02

Message: 7 of 22

"us " <us@neurol.unizh.ch> wrote:

> > Hey, I think I got it, well, partly: Sometimes you need to
> > give the m-filename including the '.m', sometimes not...
>
> this may happen if your files reside on a server;
>
> help rehash;

A restarted matlab should do the trick too, or don't?
I did not try that today, but I seem to remember to have
tried it the last time it happened.

> also, i've never encountered a situation where help only
> worked with the .m extension(?)... can you show an
> example...

Shall I copy my matlab program packet here? *lol* I really
don't know how to show an example .... but look here (just
typed into the command window):

---------snip------------
>> help questdlgtout

No help comments found in questdlgtout.m.

Use the Help browser Search tab to search the documentation, or
type "help help" for help command options, such as help for
methods.
---------snip------------

As it seems Matlab already looks into questdlgtout.m (with
extension), but does not find any help lines. Now again with
'.m' in the command:

---------snip------------
>> help questdlgtout.m
 QuestDlgTOut Question dialog with time out box.
 [... complete help follows]
---------snip------------

So, how to explain that?

In this case 'questdlgtout' is a modified questdlg (original
from mathworks), but I had unique m-files without
predecessor, so this shouldn't be an important fact here.

Norman

Subject: Re: commentary help lines

From: John D'Errico

Date: 13 Jun, 2008 11:18:02

Message: 8 of 22

"Norman " <norman.nospam.violet@tu-berlin.de> wrote in message
<g2tddi$1g3$1@fred.mathworks.com>...
> "Jos " <DELjos@jasenDEL.nl> wrote:
> > > Any idea how to change this behaviour?
> >
> > edit the m-file
>
> Well, I just added those comment lines this morning ... and
> it still does not work. I even restarted Matlab (2007b) to
> force to update its path and file informations without
> success, and changing into the folder of the file doesn't
> help either.
>
> I have written many m-files where it does work, but I have
> encountered some, like the one this morning, where it does
> not work. Is there any other undocumented condition for the
> comment lines which must be fulfilled to be accepted as help
> documentation? I know only that the lines in question must
> be in the first, continous block of comment lines in the
> file. E.g:
> function exit = foo(argument_one, varargin)
> % This shall be shown if 'help foo' is entered
> % in the command window
>
> Norman

Are you sure that you do not have multiple
copies of the file and you edited one of the
copies that was lower on the search path?

I've never heard of a case where the .m was
required in the help command. Never.

The only other possibility I can think of is
disk corruption.

John

Subject: Re: commentary help lines

From: Norman

Date: 13 Jun, 2008 11:48:01

Message: 9 of 22

"John D'Errico" <woodchips@rochester.rr.com> wrote:

> Are you sure that you do not have multiple
> copies of the file and you edited one of the
> copies that was lower on the search path?

Yes, absolutely sure.

> I've never heard of a case where the .m was
> required in the help command. Never.

see above (message #7)

> The only other possibility I can think of is
> disk corruption.

Hm, possible of course, but unlikely I think. Also I
couldn't think of a way how this behaviour could be
accomplished by a corrupted disk (by the way; it's a RAID 1
drive, that's why a hard disk failure seems unlikely to me);
everything else works.

Subject: Re: commentary help lines

From: John D'Errico

Date: 13 Jun, 2008 12:18:01

Message: 10 of 22

"Norman " <norman.nospam.violet@tu-berlin.de> wrote in message
<g2tmph$554$1@fred.mathworks.com>...
> "John D'Errico" <woodchips@rochester.rr.com> wrote:
>
> > Are you sure that you do not have multiple
> > copies of the file and you edited one of the
> > copies that was lower on the search path?
>
> Yes, absolutely sure.
>
> > I've never heard of a case where the .m was
> > required in the help command. Never.
>
> see above (message #7)
>
> > The only other possibility I can think of is
> > disk corruption.
>
> Hm, possible of course, but unlikely I think. Also I
> couldn't think of a way how this behaviour could be
> accomplished by a corrupted disk (by the way; it's a RAID 1
> drive, that's why a hard disk failure seems unlikely to me);
> everything else works.

Ok. You also mentioned that these files were
on a server.

Temporarily move them off, onto a local drive.
Test if the problem is with the location.

John

Subject: Re: commentary help lines

From: us

Date: 13 Jun, 2008 12:18:02

Message: 11 of 22

"Norman ":
<SNIP interesting help-failure...

> So, how to explain that?

just for the sake of it:

     clear all; % !!!!!
     a=inmem
% a = Empty cell array: 0-by-1
     help your_program
     a=inmem
% do you find your function in the list?
     help your_program.m
     a=inmem
% again?
     ver
% ?

us

Subject: Re: commentary help lines

From: Jos

Date: 13 Jun, 2008 12:18:02

Message: 12 of 22

"Norman " <norman.nospam.violet@tu-berlin.de> wrote in
message <g2tmph$554$1@fred.mathworks.com>...
> "John D'Errico" <woodchips@rochester.rr.com> wrote:
>
> > Are you sure that you do not have multiple
> > copies of the file and you edited one of the
> > copies that was lower on the search path?
>
> Yes, absolutely sure.
>
> > I've never heard of a case where the .m was
> > required in the help command. Never.
>
> see above (message #7)
>
> > The only other possibility I can think of is
> > disk corruption.
>
> Hm, possible of course, but unlikely I think. Also I
> couldn't think of a way how this behaviour could be
> accomplished by a corrupted disk (by the way; it's a RAID 1
> drive, that's why a hard disk failure seems unlikely to me);
> everything else works.


may the help.m itself is corrupted?

Jos

Subject: Re: commentary help lines

From: Norman

Date: 13 Jun, 2008 12:40:23

Message: 13 of 22

"John D'Errico" <woodchips@rochester.rr.com> wrote in

> Ok. You also mentioned that these files were
> on a server.

No, _I_ did not. That was an idea of 'us'. Sorry for the
confusion. All my files, including Matlab are on my local
drive(s)

Norman

Subject: Re: commentary help lines

From: Norman

Date: 13 Jun, 2008 13:05:02

Message: 14 of 22

 
> just for the sake of it:

okay, I've done that, but everything seems to be okay for me
(see below). inmem shows my program everytime (w and w/o '.m').

Norman

---------snip---------


>> clear all
>> a=inmem
a =
    'path'
    'mltimerpackage'

>> help questdlgtout

No help comments found in questdlgtout.m.

Use the Help browser Search tab to search the documentation, or
type "help help" for help command options, such as help for
methods.

>> a=inmem
a =
    'ispc'
    'filesep'
    'path'
    'iscellstr'
    'fileparts'
    'fliplr'
    'help'
    'questdlgtout'
    'mltimerpackage'
    'helptools\private\splitClassInformation'
    'helptools\private\safeWhich'
    'helptools\private\hashedDirInfo'
    'helptools\private\fixLocalFunctionCase'
    'helptools\private\fixFileNameCase'
    'helpDisplayCollector'
>> help questdlgtout.m
 QuestDlgTOut Question dialog with time out box.
 
[...]

>> a=inmem
a =
    'ispc'
    'filesep'
    'usejava'
    'figure'
    'path'
    'iscellstr'
    'fileparts'
    'fullfile'
    'errordlg'
    'msgbox'
    'fliplr'
    'helpdlg'
    'dialog'
    'textwrap'
    'help'
    'questdlgtout'
    'uiwait'
    'uiresume'
    'timer.timer'
    'mltimerpackage'
    'warndlg'
    'helptools\private\splitClassInformation'
    'helptools\private\safeWhich'
    'helptools\private\minimizePath'
    'helptools\private\makehelphyper'
    'helptools\private\hashedDirInfo'
    'helptools\private\fixLocalFunctionCase'
    'helptools\private\fixFileNameCase'
    'helptools\private\findSeeAlso'
    'helptools\private\extractCaseCorrectedName'
    'helpDisplayCollector'
    'helpClassWrapper'
    'listdlg'
    'inputdlg'

Subject: Re: commentary help lines

From: Bjorn Gustavsson

Date: 13 Jun, 2008 14:19:05

Message: 15 of 22

"Norman " <norman.nospam.violet@tu-berlin.de> wrote in
message <g2tr9u$6vt$1@fred.mathworks.com>...
>
> > just for the sake of it:
>
> okay, I've done that, but everything seems to be okay for me
> (see below). inmem shows my program everytime (w and w/o
'.m').
>
Maybe it has something about the RAID/filesystem and
matlab's caching of functions to do after all. Maybe you can
test by writing a simple test function without help, run it,
then add help and see if matlab doesn't display said help.
If so test if matlab displays the help after a 'rehash',
after a 'clear functions'.

HTH,
Bjeorn

Subject: Re: commentary help lines

From: us

Date: 13 Jun, 2008 14:21:02

Message: 16 of 22

"Norman ":
<SNIP interesting help-conundrum continued...

well, there is clearly a difference in the modules
used/needed to find the help...
what version do you run...

if(f) you have r2008a, you might try this and show the
results for both <your_fcn> and <your_fcn.m>...

     d=helpUtils.hashedDirInfo(cd)
     p=helpUtils.helpProcess(0,1,{'your_fcn'});
     p.getHelpText;
     p.helpStr

us

Subject: Re: commentary help lines

From: Norman

Date: 13 Jun, 2008 14:49:01

Message: 17 of 22

"us " <us@neurol.unizh.ch> wrote in message
<g2tvoe$2k5$1@ginger.mathworks.com>...
> "Norman ":
> <SNIP interesting help-conundrum continued...

> if(f) you have r2008a, you might try this and show the
> results for both <your_fcn> and <your_fcn.m>...

No, sorry, I still use 2007b. In the meantime I had sent the
file to some friends and on their computers (also matlab
2007b) it worked as usual, so it has to do with my paths or
something else specific with my computer/matlab. The thing I
am wondering about is: I have plenty of self-written m-files
(also in the same places) where it works as usual too.

@Bjeorn (is that really spelled that way?):
I did as you asked: new test function w/o help, than added
help and it does as requested. No hint why it does not with
'questdlgtout.m'.

I will continue to observe this in future, but since a) it's
not a really important matter, b) I don't know what else to
check and c) weekend's coming fast, I will drop this now
until monday at least. Thanks for all your help so far.

Subject: Re: commentary help lines

From: Steven Lord

Date: 14 Jun, 2008 02:51:33

Message: 18 of 22


"Norman " <norman.nospam.violet@tu-berlin.de> wrote in message
news:g2ta6d$ni9$1@fred.mathworks.com...
> Hi!
>
> I have many matlab files with comment lines at the
> beginning. With the syntax 'help <m_file>' you get these
> comment lines. This is all well known of course, but I have
> some files which seem to be coded in the same way but which
> does not give any help when 'evoked' as above. Only a 'No
> help comments found in <m_file>.' comes up. Any idea how to
> change this behaviour?

From the documentation for HELP:

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/help.html

Create self-documenting online help for your own M-files by entering text on
one or more contiguous comment lines, beginning with the second line of the
file (first line if it is a script). For example, the function soundspeed.m
begins with

*snip*

Are you certain that the help comment lines start on the second line of your
function file, with nothing but the function declaration line before it?
Even putting a semicolon before that first comment character causes HELP not
to consider that comment as M-file help.

Windows, Linux, Mac, or Solaris?

If you're on a non-Windows platform, are you matching the casing of the
M-file name in your call to HELP?


--
Steve Lord
slord@mathworks.com


Subject: Re: commentary help lines

From: Norman

Date: 14 Jun, 2008 09:10:05

Message: 19 of 22

"Steven Lord" <slord@mathworks.com> wrote...

> From the documentation for HELP:
> *snip*
>
> Are you certain that the help comment lines start on the
> second line of your function file, with nothing but the
> function declaration line before it?

Yes, I am. And there's nothing like a semicolon at the end.
The only difference might be different unprintable
characters - like CR/LF instead of only CR at the end of
line. I can't check that right now, but I will see into
that on Monday. I will also try to run a file monitor to
see what 'help' does exactly (which files are touched in
the search process).

> Windows, Linux, Mac, or Solaris?

WinXP SP3, so no case-sensitivity to behold. But I checked
it nevertheless, and also I checked if 'help' maybe can't
handle long filename (longer than 8.3 file format), but it
can.

Norman

Subject: Re: commentary help lines

From: Loren Shure

Date: 16 Jun, 2008 15:01:34

Message: 20 of 22

In article <g2ta6d$ni9$1@fred.mathworks.com>, norman.nospam.violet@tu-
berlin.de says...
> Hi!
>
> I have many matlab files with comment lines at the
> beginning. With the syntax 'help <m_file>' you get these
> comment lines. This is all well known of course, but I have
> some files which seem to be coded in the same way but which
> does not give any help when 'evoked' as above. Only a 'No
> help comments found in <m_file>.' comes up. Any idea how to
> change this behaviour?
>

are your files sitting under the MATLAB toolbox directory? We recommend
NOT placing your files there since MATLAB caches the contents so it can
speed up. If your files are there, try rehash toolboxcache. Also, move
them into a different directory outside the MATLAB tree.

--
Loren
http://blogs.mathworks.com/loren/

Subject: Re: commentary help lines

From: Norman

Date: 16 Jun, 2008 22:00:21

Message: 21 of 22

Loren Shure <loren@mathworks.com> wrote:

> are your files sitting under the MATLAB toolbox
directory? We recommend
> NOT placing your files there since MATLAB caches the
contents so it can
> speed up. If your files are there, try rehash
toolboxcache. Also, move
> them into a different directory outside the MATLAB tree.

My files are not located in or under the Matlab toolbox
path. But I thought about some cache problem here too: I
noticed (but this is a different matter), that Matlab
sometimes does not notice new files (even if definitely
created within Matlab itself); I had to change to the
directory where the new file is located before Matlab knows
about its existence (and sometimes even not after leaving
that directory again). That might be explainable - somehow
- by the amount of files which are located within my file
structure. 'Rehash' won't work neither in these cases, but
removing and adding all my pathes again will do.
(Directories with a few thousands of files are slowing down
the computer too, but that is most probably a problem
caused by Windows - but if you have any advice here too; I
am all ears !).
But this can't explain my primary question here of course,
because Matlab can access the file if named with its
extension, but not without extension.

Norman

Subject: Re: commentary help lines

From: Saad Badaoui

Date: 14 Jul, 2008 21:57:01

Message: 22 of 22

"Norman " <norman.nospam.violet@tu-berlin.de> wrote in
message <g36npl$ap2$1@fred.mathworks.com>...
> Loren Shure <loren@mathworks.com> wrote:
>
> > are your files sitting under the MATLAB toolbox
> directory? We recommend
> > NOT placing your files there since MATLAB caches the
> contents so it can
> > speed up. If your files are there, try rehash
> toolboxcache. Also, move
> > them into a different directory outside the MATLAB tree.
>
> My files are not located in or under the Matlab toolbox
> path. But I thought about some cache problem here too: I
> noticed (but this is a different matter), that Matlab
> sometimes does not notice new files (even if definitely
> created within Matlab itself); I had to change to the
> directory where the new file is located before Matlab knows
> about its existence (and sometimes even not after leaving
> that directory again). That might be explainable - somehow
> - by the amount of files which are located within my file
> structure. 'Rehash' won't work neither in these cases, but
> removing and adding all my pathes again will do.
> (Directories with a few thousands of files are slowing down
> the computer too, but that is most probably a problem
> caused by Windows - but if you have any advice here too; I
> am all ears !).
> But this can't explain my primary question here of course,
> because Matlab can access the file if named with its
> extension, but not without extension.
>
> Norman

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
bivariate Saad Badaoui 04 Aug, 2008 05:42:11
bisection method Saad Badaoui 04 Aug, 2008 05:40:50
fzero Saad Badaoui 14 Jul, 2008 18:00:25
helputils us 13 Jun, 2008 10:25:08
inmem us 13 Jun, 2008 08:20:34
help us 13 Jun, 2008 08:20:34
code us 13 Jun, 2008 08:20:34
ver us 13 Jun, 2008 08:20:34
rehash us 13 Jun, 2008 07:00:07
reference us 13 Jun, 2008 07:00:07
comment lines Norman 13 Jun, 2008 04:15:04
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics