Miscellaneous m-script commands wait for user response keyboard pause stops execution of the m-script and (press any key to continue) gives control to keyboard. halts execution of pause(10) m-script for 10 seconds appears before the prompt. K halts execution of Variables may be examined or pause(0.1) m-script for 0.1 seconds changed all commands are valid. – subsequent pause pause off Keyboard mode terminated by hitting ignored Enter input subsequent pause prompt user for input pause on commands should pause num = input('How many particles? ') menu choice = menu(header, item1, item2, ... ) Generate a menu of choices for user input. K = menu('Choose a color','Red','Blue','Green') ----- Choose a color ----- 1) Red 2) Blue 3) Green Select a menu number: The number entered by the user in response to the prompt is returned as K (i.e. implies that the user selected Blue). K = 2 Operators and special functions plus minus matrix power + - ^ array power backslash or left slash or right .^ \ / division division array division colon (subscripting, parentheses array manipulation) (contains ./ : ( ) arguments) decimal point parent directory continuation . .. … comma (argument / semicolon (suppress matrix , ; * statement separator) statement output) multiplication array multiplication comment transpose .* % ' nonconjugated assignment equality .' = =
Miscellaneous m-script commands pause wait for user response (press any key to continue) pause(10) halts execution of m-script for 10 seconds pause(0.1) halts execution of m-script for 0.1 seconds pause off subsequent pause ignored pause on subsequent pause commands should pause keyboard stops execution of the m-script and gives control to keyboard. K appears before the prompt. Variables may be examined or changed – all commands are valid. Keyboard mode terminated by hitting Enter input prompt user for input num = input('How many particles? ') menu choice = menu(header, item1, item2, ... ) Generate a menu of choices for user input. K = menu('Choose a color','Red','Blue','Green') ----- Choose a color ----- 1) Red 2) Blue 3) Green Select a menu number: The number entered by the user in response to the prompt is returned as K (i.e. K = 2 implies that the user selected Blue). Operators and special functions + plus - minus ^ matrix power .^ array power \ backslash or left division / slash or right division ./ array division : colon (subscripting, array manipulation) ( ) parentheses (contains arguments) . decimal point .. parent directory … continuation , comma (argument / statement separator) ; semicolon (suppress statement output) * matrix multiplication .* array multiplication % comment ' transpose .' nonconjugated = assignment = equality