MATLAB: Does adding a semicolon (;) at the end of SYSTEM command in MATLAB 7.6 (R2008a) does not suppress the output display

MATLABsemi-colon

I am trying to use SYSTEM function and I add a semicolon at the end of my MATLAB statement. I expect MATLAB to suppress any output generated from that statement, but it still displays the output.
Reproduction steps:
system('cd');
As I have added a semicolon at the end I expect nothing to be displayed on the command line after the system command is executed. But it still displays the path of current directory.

Best Answer

The ability to suppress the output of SYSTEM function is not available in MATLAB 7.6 (R2008a).
To work around this issue, store the outputs of SYSTEM command in some variable. For instance:
[status,result]=system('cd');
If the command runs successfully, 'status' is 0 and 'result' contains the output from command. If command fails or does not exist on your operating system, 'status' is a nonzero value and 'result' contains an explanatory message.