Week6_Workshop_Full-1

What does it mean to suppress echo how do you do it

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

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

Unformatted text preview: t mean to suppress echo? How do you do it? How do you add comments to your program? You should add “help” comments at the top of each program that indicate who wrote the program and when and what the program does. Engineering Education Clearing the workspace Before you run a program, it is good practice to clear the workspace(clear). You may also want to clear the command window(clc) clear; clc % the ; can be used to separate commands on a single line….but not recommended Make the line COST = a comment and run the program without clearing the workspace. Do you get the same values of COST and GASUSED as before? Now clear the workspace and run. What error do you get? Engineering Education Trip Program Add code to output the amount of gas used in the trip and the associated cost We will use the “fprintf” command to generate output. fprintf('\nYou need %f gallons which will cost $%.2f',GASUSED,COST) Save and run your file (be sure to put semicolons on the end of the GASUSED = and COST = lines to suppress the echo). Rem...
View Full Document

This note was uploaded on 01/28/2014 for the course ENGE 1114 taught by Professor Twknott during the Spring '06 term at Virginia Tech.

Ask a homework question - tutors are online