I am wondering if we - the Matlab users can get the code of some functions in Matlab (like fft - fast fourier transform, dwt - descrete wavelet transform, and so on.) Just in case we want to edit something to adapt with what we need. Is it possible in Matlab? and if so, how can we get the code? Thank you.
问题:
回答1:
As already mentioned, lots of MATLAB functions are written in MATLAB, so you can see the source. For performance reasons, some things are implemented in native code, or use external libraries. In the case of FFT, MATLAB uses the FFTW library, to which the source is freely available. See also http://www.mathworks.co.uk/help/techdoc/ref/fftw.html
回答2:
Type "edit function.m" (without quotes), where "function" is the name of the function with the code you wish to view.
Read more: http://www.ehow.com/how_8465386_matlab-function-codes.html#ixzz2wILKOXJI
回答3:
There is an option in matlab under the current directory menu on the left , the option name is "find Files" which is represented as an icon of binoculars, simply click on it, set the directory to "Enter Matlab Path" and enter the function name to search,
for example, if i want to search function imnoise , i'd type "imnoise.m" after getting the result of the search, simply double click on the function file and there you can edit whatever you want
回答4:
To summarize a bit, there a several ways to do it.
E.g., if we want to see the source code of function imread
:
a) edit
to edit or create file
edit imread; %namely, edit('imread') edit imread.m; %edit('imread.m')
b) open
to open file in appropriate application
open imread; %open file 'imread.m' with matlab editor
c) type
to display contents of file:
type imread; %this will display all the contents in command window, which is hard to read
Note that funcName stringLiteral
is the command syntax, which equals its function syntax funcName('stringLiteral')
. See Command vs. Function Syntax