Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: get help info into my program

  • To: mathgroup at smc.vnet.net
  • Subject: [mg82893] Re: [mg82844] Re: get help info into my program
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Fri, 2 Nov 2007 03:35:16 -0500 (EST)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <fg9ok6$mbn$1@smc.vnet.net> <200711011013.FAA07736@smc.vnet.net>
  • Reply-to: murray at math.umass.edu

Sorry, I missed the original message to quote below.  There are two 
separate issues:

(1) Writing "?" help for your own function.  That is accomplished by 
defining a string for your function MyFunc in the form:

   usage::MyFunc="MyFunc[arg1,arg2] give the result..."

(2) Making the usage message for any function -- whether for a built-in 
function or a user-defined function (for which you defined a 
corresponding usage message) -- be printed within a program.

For that, use:

   Information[functionName]

For example:

   Information[Plot]
   Information[myFunc]

Of course if this is one of several commands within a compound 
expression, e.g., within a Module, then you'll want to wrap that with a 
Print function:

    Module[{vars}, doThis; Print[Information[myFunc]]; doThat]


Jens-Peer Kuska wrote:
> Hi,
> 
> str = Plot::usage
> 
> ??
> 
> Regards
>    Jens
> 
> congruentialuminaire at yahoo.com wrote:
>> Hello Mathematica UG:
>>
>> How can I get the result of the '?' command into my program? When I
>> evaluate the following:
>>
>> ?Plot
>> %
>>
>> the result I get is:
>>
>> {Null}
>>
>> Is it possible to get the results of the '?' command?
>>
>> This is not a frivolous question. I use the '?' command during my
>> debugging and I want to make my program (which are executed sometimes
>> by other people) more robust by checking various things (using '?')
>> before and during their execution.
>>
>> TIA.
>>
>> Regards..
>>
>>
> 

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: Re: Re: Problem with element and Maximize
  • Next by Date: Re: Setting Negatives to Zero
  • Previous by thread: Re: get help info into my program
  • Next by thread: Re: get help info into my program