Reputation: 1663
after one installs a package, what is the command to find what functions are in that package?
for example, I have the control
package installed. But how find help on this package such as what functions it includes and such, like with Matlab?
does one have to go to the http://octave.sourceforge.net/ web site each time to find out? Can one find this information from inside octave?
I find Matlab help much better and easier to use than octave.
Upvotes: 4
Views: 8836
Reputation: 1356
I wrote a short octave function, that solves your problem: It creates a dialogue box to display all functions in a package. After selecting one function it will display it's the help text in a message box. Just save the following octave function to a file named pkghelp.m
and run it by typing
pkghelp packagename
.
The following will display the function overview for package 'io':
pkghelp io
% Script to display functions and help on functions for a package
function pkghelp(pkgname)
% Get functions for this package
des = pkg('describe','-verbose',pkgname);
% Get first element
des = des{1};
if isempty(des)
error('pkghelp:unknownPackage','Package "%s" was not found!',pkgname);
endif
% Create a dialog with functions
pname = des.name;
pvers = des.version;
pdesc = des.description;
% Number of categories
ncat = numel(des.provides);
list = cell(1,1);
cnt=1;
for i=1:ncat
% Store category name
list(cnt) = ['--(* ',des.provides{i}.category,' *)--'];
% Number of functions
nfunc = numel(des.provides{i}.functions);
% Append functions in category
list(cnt+1:cnt+nfunc) = des.provides{i}.functions(:);
% Update counter
cnt = cnt+1+nfunc;
endfor
ok=1;
while ok==1
% Create dialog
[sel, ok] = listdlg ('ListString', list,...
'SelectionMode', 'Single', ...
'ListSize',[300,600],...
'Name',pname,...
'PromptString','List of available functions');
if (ok==1)
% Selected function name
selfun = list{sel};
% Not a category?
if selfun(1) ~= '-'
% assure that package is loaded for help
pkg('load',pkgname);
% Get help text for selected function
doc = help(selfun);
% Open dialog with help text display
msgbox(doc,[pname,'/',selfun],'help');
endif
endif
endwhile
endfunction
Upvotes: 2
Reputation: 13091
Use pkg describe -verbose control
to get all info from the control package.
Upvotes: 6
Reputation: 3729
Under Linux, from either within Octave or Bash (works equally), check out the package folders:
me@computer:/usr/share/octave/packages> ls -la
drwxr-xr-x 3 root root 4096 22. Okt 2011 .
drwxr-xr-x 5 root root 4096 22. Okt 2011 ..
drwxr-xr-x 4 root root 4096 22. Okt 2011 openmpi_ext-1.0.1
Your "control" package should appear here, as a folder. Enter the folder(s) and check out the details ...
me@computer:/usr/share/octave/packages> cd openmpi_ext-1.0.1/
me@computer:/usr/share/octave/packages/openmpi_ext-1.0.1> ls -la
drwxr-xr-x 4 root root 4096 22. Okt 2011 .
drwxr-xr-x 3 root root 4096 22. Okt 2011 ..
-rwxr-xr-x 1 root root 346 24. Nov 2010 allnodes
drwxr-xr-x 2 root root 4096 22. Okt 2011 doc
-rw-r--r-- 1 root root 3694 24. Nov 2010 doc-cache
-rw-r--r-- 1 root root 967 24. Nov 2010 hello2dimmat.m
-rw-r--r-- 1 root root 1706 24. Nov 2010 hellocell.m
-rw-r--r-- 1 root root 1359 24. Nov 2010 hellosparsemat.m
-rw-r--r-- 1 root root 1711 24. Nov 2010 hellostruct.m
-rw-r--r-- 1 root root 1726 24. Nov 2010 helloworld.m
-rw-r--r-- 1 root root 1506 24. Nov 2010 mc_example.m
-rw-r--r-- 1 root root 4721 24. Nov 2010 montecarlo.m
drwxr-xr-x 2 root root 4096 22. Okt 2011 packinfo
-rw-r--r-- 1 root root 3535 24. Nov 2010 Pi.m
Upvotes: 1