23.12.2012 Views

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

dos<br />

2dos<br />

Purpose Execute a DOS command and return result<br />

Syntax dos command<br />

status = dos('command')<br />

[status,result] = dos('command')<br />

[status,result] = dos('command','-echo')<br />

Description dos command calls upon the shell to execute the given command for Windows<br />

systems.<br />

2-458<br />

status = dos('command') returns completion status to the status variable.<br />

[status,result] = dos('command') in addition to completion status, returns<br />

the result of the command to the result variable.<br />

[status,result] = dos('command','-echo') forces the output to the<br />

Command Window, even though it is also being assigned into a variable.<br />

Both console (DOS) programs and Windows programs may be executed, but the<br />

syntax causes different results based on the type of programs. Console<br />

programs have stdout and their output is returned to the result variable. They<br />

are always run in an iconified DOS or Command Prompt Window except as<br />

noted below. Console programs never execute in the background. Also,<br />

<strong>MATLAB</strong> will always wait for the stdout pipe to close before continuing<br />

execution. Windows programs may be executed in the background as they have<br />

no stdout.<br />

The ampersand, &, character has special meaning. For console programs this<br />

causes the console to open. Omitting this character will cause console programs<br />

to run iconically. For Windows programs, appending this character will cause<br />

the application to run in the background. <strong>MATLAB</strong> will continue processing.<br />

Examples The following example performs a directory listing, returning a zero (success)<br />

in s and the string containing the listing in w.<br />

[s, w] = dos('dir');<br />

To open the DOS 5.0 editor in a DOS window<br />

dos('edit &')

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!