Veiwing the source code for a function in Matlab?
조회 수: 165 (최근 30일)
이전 댓글 표시
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
Stephen23
2019년 1월 30일
편집: Stephen23
2019년 1월 30일
"...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.
채택된 답변
Jan
2019년 1월 30일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!