matlab - Overwrote built in function - Standard deviation -


i want have std.m file standard deviation. in data fun toolbox, but, mistake, changed code , std command not working anymore. how can run original std (standard deviation) command?

taking comments out, function std.m extremely simple:

function y = std(varargin)     y = sqrt(var(varargin{:})); 

this definition of standard deviation: square root of variance.


  • set built-in functions read-only

now don't go breaking var.m file because more complex , wonder if there copyright issue display listing here.

to avoid problem of breaking built-in files, advisable set matlab toolbox files read only. remember old matlab installer giving option @ install time. don't know if installer still offers option, if not extremely easy manually (on windows, select folders, right-click properties, tick read only , accept propagate property subfolders , files).


  • overloading

once done, built-in files safe. can still modify default behavior of built-in function overloading it. consist in writing function same name , arrange called before default function (your overload function becomes default one).

this article explain how overload user functions.

matlab not recommend directly overload built-in functions (rather call name mystd.m example), if insist feasible , still better option modifying built-in function... at least original function still intact somewhere.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -