13.01.2015 Views

Chapter 4: Programming with MATLAB - FET

Chapter 4: Programming with MATLAB - FET

Chapter 4: Programming with MATLAB - FET

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.

4-22<br />

Strings and the input Statement<br />

The prompt program on the next slide uses the<br />

isempty(x) function, which returns a 1 if the array x is<br />

empty and 0 otherwise.<br />

It also uses the input function, whose syntax is<br />

x = input(’prompt’, ’string’)<br />

or<br />

x = input(’prompt’, ’s’)<br />

This function displays the string prompt on the screen,<br />

waits for input from the keyboard, and returns the<br />

entered value in the string variable x.<br />

The function returns an empty matrix if you press the<br />

Enter key ( ) <strong>with</strong>out typing anything.<br />

Z.R.K

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

Saved successfully!

Ooh no, something went wrong!