8_pdfsam_3 - (the default turns o± command display and...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
6 s1 = -2 s2 = -3 Comments: % qroots : % allows a comment to be added format compact : Suppresses the extra lines in the output display a=1, b=5, c=6 : Sets values of a, b, c , will display result x y : Semicolon at end of command means these intermediate values won’t be displayed s1, s2 : Compute and display roots Search rules for qroots command: 1. Display current Matlab variable qroots if deFned 2. Execute built-in Matlab command qroots if it exists 3. Execute qroots.m if it can be found in the Matlab search path (described below) Commands within the M-Fle have access to all variables in the Matlab workspace and all variables created by the M-Fle become part of the workspace. Commands themselves are not normally displayed as they are evaluated. Placing the echo on command in the M-Fle will cause commands to be displayed. The command echo off
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: (the default) turns o± command display and echo by itself toggles the command echo state. You could repeatedly edit qroots.m , change the values of a, b, and c, save the Fle, then have Matlab execute the revised script to compute a new pair of roots. Matlab functions useful in M-Fles: Command Description disp(ans) Display results without identifying variable names echo [on|off] Control Command window echoing of script commands input(’prompt’) Prompt user with text in quotes, accept input until “Enter” is typed keyboard Give control to keyboard temporarily. Type Return to return control to the executing script M-Fle. pause Pause until user presses any keyboard key pause(n) Pause for n seconds waitforbuttonpress Pause until user presses mouse button or keyboard key 44...
View Full Document

This note was uploaded on 03/07/2010 for the course ENG 101 taught by Professor Chang during the Summer '09 term at 東京国際大学.

Ask a homework question - tutors are online