MATLAB: Am I unable to view the source code for built-in functions or DLL-files in MATLAB

built-incodedllfilesfunctionsMATLABsourceview

I would like to view the source code for built-in functions or DLL-files in MATLAB?

Best Answer

Source files for all of our MATLAB code can be viewed directly in MATLAB; you can use the EDIT or TYPE commands to view them (in fact, we encourage you to look at our files to learn more about the way in which they're implemented). Source files for many of the compiled .dll files are also viewable; in these cases you would need to view the related .c file. For example:
which histc
D:\MATLAB6p1\toolbox\matlab\datafun\histc.dll
which histc.c
D:\MATLAB6p1\toolbox\matlab\datafun\histc.c
edit histc.c
There are cases, however, where we have not made available the source code for our functions. In many of these cases the algorithms that we use can be obtained from our documentation or with the DOC command. When using the DOC command, you'll want to look at the "Algorithm" and "References" sections for the relevant information. For example, EIG is a built-in function and its source code is not available in MATLAB. But 'doc eig' provides extensive details about the exact algorithms this function implements; and the references listed allow you to learn more about how the function is implemented.
There are some cases where we do not wish to release source code for our products. Typically, this is because we felt that releasing this code provides no additional benefit over what's provided in the "Algorithm" and "References" sections given by the DOC command, or isn't in the best interests of MathWorks' community. If you feel that you have a specific need related to using our products which requires you to see source code that isn't available, please let us know what that need is. This will allow us to directly address that need by providing additional information or documentation.