Thursday, September 27, 2007

Matlab Tutorial II



Working with Loading Files and Input Commands



Welcome to another addition of Matlab Tutorial, your one fast track to computer programming!! (Wow that kinda sounds lame and a little cliche). This issue will cover some new but still very useful tools while working in the Matlab program.



Sometimes you are working with a program that you can use on any type of text file you have with numbers in it. If you were to go and manually type in each set of data or try to copy paste all the data, you may not get exactly the right set up you are looking for, or you down right get tired of typing in all those numbers! But fear not, there is a solution. That solution I speak of is the load command. It takes files from an outside source (must be from same directory that you are currently in on Matlab) and places the information or data from that file and inputs all of it into Matlab. Pretty nice I must say. Type load ('filename.txt') and you will be able to upload all sorts of numbers with just a click of a mouse! (I should really stop doing that...)



Another cool command that can be fun but still simple is the input command. This command usually is needed in any program that you need the user, or person running your program, to punch in or "input' their own data to get a certain result or answer. It helps if you want to make a universal program that does any kind of arithmetic computation or equation, like the Pythagorean Theorem or Hooke's Law. To create such a lovely device, use input ('What the user will see').


Well that is all I have for this issue. Hope you guys are getting better at using Matlab! I'm a little ashamed to say it, but once you get done the commands and concepts, Matlab can almost be f- f-...fun. Here are some of those resources again for better reference:University of Florida Matlab page; University of Michigan Engineering Matlab page; MathWorks Resource Page


Sorry if you viewed the first copy of this article, I accidentally posted it while I was still working on it, hence the errors and incomplete article. I also added a photo to spice it up.

No comments: