Overload! (bang)

In response to this question , the MathWorks support team states that:

It is also possible to overload! (bang) by creating a file called "! .m" and having this file in front of the $ MATLABROOT \ toolbox \ matlab \ general directory in the MATLAB search path.

I tried this and it doesn't seem to work. I am running Matlab 9.1.0.441655 (R2016b) on Linux Mint. My path is as follows:

/home/raphael/Programs/Test
/usr/local/MATLAB/R2016b/toolbox/matlab/iofun
...
/usr/local/MATLAB/R2016b/toolbox/matlab/general
...

and I created the file !.min /home/raphael/Programs/Test. Whatever I put in this file, the editor displays an error message:

Line 1: Unable to run code analysis. '/home/raphael/Programs/Test/!.m' is an invalid file name.

How! (bang) is not specified in the Operators and associated list of functions , it is unclear what to put in the file !.m.

I still tried to put the code:

function bang(c)

disp(c)

which ! , Matlab :

>> which !
/home/raphael/Programs/Test/!.m

>> !pwd
/home/raphael/Programs/Test

bang.m , bang.

:

  • Matlab R2012?
  • ! (bang)?
  • , ?
+4
1

, !.m R2015b ( , ).

, R2015b, !.m , ( MATLAB).

!.m

function bang(varargin)
    disp('bang!')
end

MATLAB ! !.m, system, unix dos. .

, OS X unix.m :

unix.m

function varargout = unix(varargin)
    disp('My Unix Command')
    [varargout{1:nargout}] = builtin('unix', varargin{:});
end
+5

Source: https://habr.com/ru/post/1664770/


All Articles