lecturenotes9_12 - 9/11/2008 1 Command Window Input and...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 9/11/2008 1 Command Window Input and Output Friday September 12, 2008 User Input Input Statement Syntax: >> varname = input(Instructions to user); From wind power example: >> WindSpeed = input(Please enter the wind speed in m/s.) This prints the text in quotes to the command window and awaits user input The value that the user enters is now assigned to the variable name given in the input statement. Input Statement Options We can also have the user enter matrices: >> x = input(Enter the values for the matrix in brackets.) Use can now ente Use can now enter [1 2 3, 4 5 6] and now = 6 5 4 3 2 1 x And strings The user can also enter a string. >> x = input(Input your name.) will not work (it will only take the first value, as it reads the string as a sequence of scalars. The correct way to do this is: >> x = input(Input your name in quotes.) joe OR >> x = input(Input your name., s) tells matlab to expect a string as input 9/11/2008...
View Full Document

Page1 / 4

lecturenotes9_12 - 9/11/2008 1 Command Window Input and...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online