Matlab Tutorial Part B

Matlab Tutorial Part B - Loops FOR Repeat statements a...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Loops FOR Repeat statements a specific number of times. The general form of a FOR statement is: for variable = start:increment:stop expression; end Example: a = 0; for i = 1:.1:10 a = a + 1; end WHILE Repeat statements until condition is not true (Caution, can run for infinity!). The general form of a WHILE statement is: while expression statements end Example: stopLoop = 10; a = 1; while a < stopLoop a = a +1; end IF IF statement condition. The general form of the IF statement is if expression statements elseif expression statements else statements end Example: if 1 ~= 1 fprintf('programming'); else fprint('is fun') end BREAK Terminate execution of WHILE or FOR loop
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Reading-Writing data with matlab The area of memory accessible from the command line is called workspace . As you create variables, they are stored in the workspace for that session. If you want to save the variables in the workspace into disk then you type save. This command saves all the variables in the workspace into the binary file matlab.mat . If you want to save them in a particular file then type save
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/22/2011 for the course ABE 6031 taught by Professor Burks during the Summer '11 term at University of Florida.

Page1 / 4

Matlab Tutorial Part B - Loops FOR Repeat statements a...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online