how can we see the inner programming of any function??
Show older comments
i am using the function "gradient". i want to see it's inner programming. can i see it.
thanks
Navneet nayan
Accepted Answer
More Answers (1)
Steven Lord
on 11 Apr 2017
1 vote
The gradient function is implemented as a MATLAB function file, so you can view it. If it's read-only in your installation (to prevent the possibility of modifying it) you can edit it. If it's writable, you may want to type or dbtype it instead to avoid accidental modification.
Note that not all functions in MathWorks products are implemented as MATLAB script, function, or class files. Particularly for the built-in functions, if you want to see their source code your first step would need to be here.
3 Comments
Guillaume
on 11 Apr 2017
I must say I've never had issues with edit'ing built-in files. But then, I don't press save willy-nilly.
Since it seems to be a problem for some people:
Suggestion to Mathworks: set the read-only attribute on all built-in m files. Perhaps it's been considered in the past and for some reason interfere with matlab?
Steven Lord
on 11 Apr 2017
I believe I remember that in the past we did offer that as an option in the Installer. I don't know off the top of my head if that's now the default (because of where MATLAB gets installed, it might be at least on Windows.) The installation documentation doesn't mention it, so it might be.
Jan
on 12 Apr 2017
I install Matlab with admin privileges and work as standard user. Then overwriting built-in function is not possible.
Categories
Find more on Entering Commands in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!