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.
Use pkg describe -verbose control
to get all info from the control package.
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 typingpkghelp 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
octave
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With