how do we write a code on similar lines to the matlab inbuilt functions

조회 수: 9 (최근 30일)
SHANTANU KSHIRSAGAR
SHANTANU KSHIRSAGAR 2020년 4월 15일
댓글: Steven Lord 2021년 8월 19일
As the source code of the Matlab fuctions is not disclosed, how to face situation when you are building a similar function due to lack of such toolbox. how to view the algorthm or the flow of the function?
@Walter Roberson i saw your post for the sort function, can you assist on the same.

답변 (1개)

Abhishek Kolla
Abhishek Kolla 2021년 8월 19일
The source code of a in-built function in Matlab can be found by simply typing the following code in command window
open function
where function is the name of the in-built function .
  댓글 수: 1
Steven Lord
Steven Lord 2021년 8월 19일
Be careful with your terminology. For functions included in MATLAB that are implemented as MATLAB script, function, or class files you can open them and read the code. One example is the ode45 function.
which ode45 % can be viewed
/MATLAB/toolbox/matlab/funfun/ode45.m
But if you are talking about functions implemented as part of the MATLAB executable and library files (like sort) that will not work.
which sort % cannot be viewed
built-in (/MATLAB/toolbox/matlab/datafun/sort)
To answer the general question, we don't generally distribute the source code for built-in functions (that are part of the MATLAB executable and libraries.) If you need this, approach your sales representative to discuss the possibility of viewing the code under an NDA.
If you're trying to implement a function from a toolbox you don't have licensed and/or installed, you can take a look at its documentation page in the online documentation to determine what the function does. As for determining how it does what it does, you may need to do research in the literature to determine the right algorithm to implement for your needs.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by