How can I have lookfor show help for files within packages?

Hi -
Over the last few years, I've started writing most of my Matlab code in packages. However, I don't seem to be able to search the help of these functions with lookfor, even if those functions are on the Matlab path.
Example: suppose a I have a package file:
+mypackage/mymfile.m
function y = mymfile(x)
% MYMFILE - performs a computation
%
% Y = MYMFILE(X)
%
% Returns the square of X.
%
y = x.^2;
If I type
lookfor computation
on the command line, mymfile is not found. How can I tell lookfor to search through my packages?
The behavior I expect is that it would return
mypackage.mymfile - performs a computation
(and the other matches on my workspace)
Thanks
Steve

Réponses (1)

Anshika Chourasia
Anshika Chourasia le 29 Déc 2021
Hi Steve,
I understand you would like to search within packages when using "lookfor". This feature is not currently available.
As an alternative, you can use the Function Browser. This is the "fx" button located just to the left of the prompt in the Command Window. You may also be able to do this using the “builddocsearchdb” function.

4 commentaires

Thanks for your reply Anshika.
I tried the Function Browser but it only lists the Matlab toolboxers, not my user code (even my user code that is not in packages). Is this the expected behavior for the Function Browser?
The builddocsearchdb function seems to allow you to build search databases from html code. I don't know if there is a use case for having it build databases from .m code.
Best
Steve
Anshika Chourasia
Anshika Chourasia le 6 Jan 2022
Modifié(e) : Anshika Chourasia le 6 Jan 2022
It may be possible that Function Browser is only listing MATLAB relavant strings. You can refer this link to know about alternative functionalities for the "lookfor" command.
Thanks very much for looking! I'd really like a solution that one can use on the command line. Is it possible to turn this into a feature request for lookfor, or a similar command?
I think it really ought to be in lookfor, right? Isn't that where most people look for existing functions that may perform a task?
Thanks again for your help
Best
Steve
Yes, you may be right. Our development team might consider this issue, till that time you can utilize alternative functionalities avaliable.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange

Produits

Version

R2019a

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by