List of all embedded characters in Matlab / Octave

In Mathematica, you can get the names of all built-in functions, starting, for example, Listby running the command

Names["List`*"]

Besides,

Names["context`*"] 

lists all characters in the specified context. For instance.

Names["Global`*"] 

gives the names of all the embedded characters (as well as those defined by the user in the global context, if any).

Are there similar structures in Matlab / Octave?

+4
source share
2 answers

In Octave, you can use the following functions:

__operators__              : Undocumented
__keywords__               : Undocumented
__builtins__               : Undocumented
__list_functions__         : Return a list of all functions (.m and .oct functions) in the load path or in the specified directory.
localfunctions             : Return a list of all local functions, i.e., subfunctions, within the current file.

And an undocumented function __dump_symtab_info__that produces a character table containing the names of functions and variables in different areas:

__dump_symtab_info__ (scope)               : Dump symbol table of the given scope
__dump_symtab_info__ (__current_scope__)   : Dump symbol table of the current scope
__dump_symtab_info__ ("functions")         : Dump globally visible functions from symbol table
__dump_symtab_info__ ("scopes")            : List available scopes
__dump_symtab_info__ ()                    : Everything
+5
source

, MATLAB Octave __list_functions__ . :

% Generate a list of all directories searched by MATLAB:
pathlist = strsplit(path,pathsep);
% Get functions and classes on search path
functions = {};
classes = {};
for p = pathlist
   w = what(p{1});
   functions = [functions; ...
                erase(w.m,'.m'); ...           % M-files
                erase(w.mex,['.',mexext]); ... % MEX-files
                erase(w.p,'.p')];              % and P-files are all functions
   classes = [classes; w.classes];             % here are all classes 
   % TODO: w.packages gives package directory names, examine those too!
end
% Remove duplicates
functions = unique(functions);
classes = unique(classes);

, ( , package.function, +). what('package') .

, , . . , toolbox/matlab.

, , , . MATLAB iskeyword, , . (type iskeyword edit iskeyword) .

.


, inmem . , MATLAB, , clear functions clear all. , clear functions.

+3

Source: https://habr.com/ru/post/1696193/


All Articles