Suppose I have my own function named zeros on the Matlab path. Now I want to call the built-in zeros. How can I do that?
            Asked
            
        
        
            Active
            
        
            Viewed 132 times
        
    2
            
            
        
        Amro
        
- 123,847
 - 25
 - 243
 - 454
 
        Michael Litvin
        
- 3,976
 - 1
 - 34
 - 40
 
1 Answers
4
            Use the builtin function:
builtin(function, arg1, ..., argN)
In your case e.g.:
builtin('zeros', 50)
        Michael Litvin
        
- 3,976
 - 1
 - 34
 - 40
 
        sitic
        
- 539
 - 4
 - 13
 
- 
                    Do you know if there's a way to get a handle to the buil-in `zeros`? – Michael Litvin Aug 13 '13 at 09:57
 - 
                    If you've overridden the builtin `zeros` with your own zeros, you can change directory to `\toolbox\matlab\elmat` (which is where the builtin `zeros` lives, and get a handle to it with `h = @zeros`. This works as when you're in that directory, the builtin is ahead of yours on the path. When you return to your previous directory, `h` will still be a handle to the builtin. – Sam Roberts Aug 13 '13 at 10:50
 - 
                    2PS DON'T override `zeros`. Even the my `doc` command doesn't work now, thanks :) – Sam Roberts Aug 13 '13 at 10:53
 - 
                    Here's a better way: `h = @(x)builtin('zeros', x(:))` – Sam Roberts Aug 13 '13 at 10:56