Main Content

inmem

Names of functions, MEX files, and classes in memory

Description

example

[F,M,C] = inmem returns the names of the functions, MEX files, and classes that are currently loaded.

example

[F,M,C] = inmem("-completenames") returns the full names of the functions and MEX files in memory, including the file path and extension. For classes, the function behaves the same as in the previous syntax.

Examples

collapse all

List the functions that remain in memory after running your code.

Clear the memory, and then call the magic function.

clear all
X = magic(100);

Return the list of functions that are currently loaded. Verify that the list includes magic.

F = inmem;
ismember("magic",F)
ans = logical
   1

Call the MEX function arrayProduct, and then verify that the function is in memory. You must have a supported C compiler installed on your system to run this example.

Clear the memory. Then, copy the source code example from the examples folder.

clear all
copyfile(fullfile(matlabroot,"extern","examples","mex","arrayProduct.c"),".","f")

Build the MEX file and test it. The output displays information specific to your compiler.

mex arrayProduct.c
s = 5;
A = [1.5 2 9];
B = arrayProduct(s,A)
Building with 'Microsoft Visual C++ 2019 (C)'.
MEX completed successfully.

B =

    7.5000   10.0000   45.0000

Return the list of MEX files that are currently loaded. Verify that the list includes arrayProduct .

[F1,M1] = inmem;
ismember("arrayProduct",M1)
ans =

  logical

   1

Now, return the full names of the MEX files, including the file path and extension. The output displays arrayProduct in your current folder.

[F2,M2] = inmem("-completenames");
M2
M2 =

  1×1 cell array

    {'C:\work\MyExamples\arrayProduct.mexw64'}

Output Arguments

collapse all

Names of the functions in memory, returned as a cell array of character vectors. If you call inmem with "-completenames", the returned values are full names including the file path and extension.

Names of the MEX files in memory, returned as a cell array of character vectors. If you call inmem with "-completenames", the returned values are full names including the file path and extension.

Names of the classes in memory, returned as a cell array of character vectors. The returned values are the same whether or not you call inmem with "-completenames".

Tips

  • If you call inmem with any text input other than "-completenames", it behaves as if it were called with no input.

Extended Capabilities

See Also

| |

Introduced before R2006a