Here's a simple example of how to use a for loop to iterate through a vector and print out each value:
main.m83 chars6 lines
This will display the following output in the command window:
main.m10 chars6 lines
Explanation:
myVector with five elements.length() function. The i variable takes the values 1 through 5.disp() function to print out each value of myVector at position i.This is just one simple example, but there are many other things you can do in MATLAB, from data analysis to building complex models.
gistlibby LogSnag