Veiwing the source code for a function in Matlab?

215 ビュー (過去 30 日間)
Yildirim Kocoglu
Yildirim Kocoglu 2019 年 1 月 30 日
編集済み: Yildirim Kocoglu 2019 年 1 月 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
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.
Yildirim Kocoglu
Yildirim Kocoglu 2019 年 1 月 30 日
編集済み: Yildirim Kocoglu 2019 年 1 月 30 日
I‘m not planning to do anything with the copyright code other than use it for learning. I was just curious if anyone has come across a built-in function in these toolboxes that can’t be viewed but, you are right: It’s probably a better idea to ask this question directly. Thanks.

サインインしてコメントする。

採用された回答

Jan
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 ExchangeGet Started with MATLAB についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by