Friday, October 19, 2007

Matlab V

Displaying Command



Well it is a new week and another issue of Matlab Tutorial. It's not a very long article this week, I'm just going to show you a simple command that lets you display anything you want, like numbers or statements. It is useful to you when you are either creating "if" statements (which I will explain in later issues) or outputting units of qualitative data (data without numbers). The display command is simply typing in disp ('Whatever you want displayed') and the program will output whatever you typed in the display command. It doesn't matter where in your program you write it, it shouldn't cause any problems being inside loops or between different commands. It does display in the order you put the command, so if you are displaying multiple things, be sure to have them placed in the code where on the output screen you want it to show up.




So lets pretend you type in two display commands, one with syntax disp ('Welcome to Matlab') and another one with syntax of disp ('Thank you for running my program'). You must make sure to type the first command in before all of your other code. The next display should come after all of your code, not just after your first display command. If you do this, then your quantitative outputs will come after your message and not make sense.
Well that's all for issue 5. Have fun Matlab-ing it this weekend!



On a side note, it has come to my attention that there is a possibility that other authors would like to contribute to my so called Matlab Tutorial. If any of you are interested, just give me the heads up so I don't write the same issues as you and you too can be part of the team here at Matlab Tutorial (which would basically double the staff working on it)

No comments: