MATLAB Answers

Matlab code on Modification of an inbuilt function

7 views (last 30 days)
Aleem Ayobami
Aleem Ayobami on 19 Jul 2021
Answered: Walter Roberson on 19 Jul 2021
i am working on a departmental project, 'Modification of matlab inbuilt function'. i am currently ignorant on how to go about it.
An example of a modified or rewritten inbuilt function could help and go a long way.
Say, inv(A). how do we do some modifcation regards to the function. A well/detailed example of the modification of the function is fervently needed.
i am new to matlab but i really need all the help i can get in order to make this project. it also an avenue to be well/learned.
  1 Comment
Stephen
Stephen on 19 Jul 2021
In general "Modification of matlab inbuilt function" is very unlikely to be a good approach: you can easily break many many things in your MATLAB installation without realizing it. I strongly recommend you avoid doing this.
A much better approach would be to create your own data class, and overload the numeric operators to suit:

Sign in to comment.

Answers (2)

Steven Lord
Steven Lord on 19 Jul 2021
We do not distribute the source code of the inv function. Therefore if you want to modify it you will need to start on our Careers page. Or if you want to request that MathWorks changes how inv is implemented to add additional functionality you could file an enhancement request with Technical Support using the Contact Support link on the Support section of our website. [That's also how you can report bugs in the software.]
There are two different types of functions that users commonly refer to as "built-in" functions. Some are built into the application and we do not distribute their source code. inv falls into this category. Others I refer to as "MATLAB scripts / functions / classes included in MATLAB". One example of this is the ode45 function, implemented as a MATLAB function file ode45.m.
which ode45
/MATLAB/toolbox/matlab/funfun/ode45.m
While you could modify the latter class of functions, I strongly discourage you from doing so unless you are extremely familiar with the subject matter and have made a backup of the unmodified function. Changing the answers those functions return can impact other functions that call those functions and those other functions can impact yet other functions, etc.

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by