Veiwing the source code for a function in Matlab?
169 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Yildirim Kocoglu
el 30 de En. de 2019
Editada: Yildirim Kocoglu
el 30 de En. de 2019
Hello,
I am aware that there is an option to look into the source code of a function in Matlab by typing the code below:
open functionx
(functionx above can be any function that I'm interested in):
I was able to look into the source code for the specific function that I wanted so my question is not how to do it.
My question is: Are there certain functions which I can't see the source code due to commercial reasons?
If yes, is there a faster way of knowing which function source codes I can't view/open in matlab? Is there a list avaiable somewhere?
To narrow the list down, I'm specifically interested in functions that are related to statistics and machine learning.
The reason I'm interested in veiwing the source code for these functions is understanding the Machine learning/Statistics concepts better while reading through the theory.
Second Queston:
I'm also interested in the list of available functions (all) for machine learning and statistics.
Is there a list available for these functions in the matlab 2018a version?
Any help is appreciated.
5 comentarios
Stephen23
el 30 de En. de 2019
Editada: Stephen23
el 30 de En. de 2019
"...I’m just trying to see if there is a possibility of me running into a problem in the future..."
Looking at copyright code is one thing, but copying or dsitributing copyright code is something else entirely. You do not say what you intend to do with that MATLAB's copyright code, so we cannot possibly tell you if it might be a "problem" or not. In any case, you should read your MATLAB license, which tells you what you are allowed to do with that code.
We are mostly volunteers who are totally unafilliated with TMW, so our opinions count for nothing anyway. You should contact TWM directly if you want to know more about your license conditions.
To read the source code for compiled functions you can get a job at TMW.
Respuesta aceptada
Jan
el 30 de En. de 2019
Do you have Matlab installed already? Then you can check tis easily by your own: Search the folder in Matlab's installation folder, which contain the wanted toolboxes. If it is e.g. "stat":
List = dir(fullfile(matlabroot, 'toolbox', 'stat', '**', '*.m'));
Now you have a list of all M-files. Some of them might contain the help text only, while the actual code is compiled. You can look into the files manually or read them in a loop:
for k = 1:numel(List)
File = fullfile(List(k).folder, List(k).name);
Data = strsplit(fileread(File), '\n');
Data = strtrim(Data);
Data(strncmp(Data, '%', 1)) = [];
n = nnz(cellfun('length', Data));
if n > 0
disp(File)
end
end
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!