Blog MLab
Matlab syntax tricks

By Raphaël - December 18th, 2016

Matlab

0 Comment

Operator overload
Styling command window output

The !(bang) operator

Matlab makes operating system calls through the built-in functions unix, dos and system. But one can also use the ! (bang) operator. For instance, on a linux machine:

>> !pwd
/home/user/path/to/here

However, this is rarely useful. One usually wants to define on-the-fly parameters to send to the shell command and get the result in a Matlab variable, not printed in the console, and both are not implemented. One can still use the eval function for defining parameters dynamically and the diary system to get the output stored in a .mat file. But frankly, it is much easier and elegant to use the system function.

Operator overload
Styling command window output

Comments

There are no comments on this post so far. Write a comment.