Matlab 7 - Matlab 7 Loops within loops! Tian Gu ID:...

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

View Full Document Right Arrow Icon
1 Matlab 7 Loops within loops! Tian Gu ID: 853324472 Team partner: Tielong Su Chaojun Zhang This lab still focuses on using loops. We studied the loop “while” and “embedded”. And we tried to use them to finish some programs. Introduction A new loop and Rock-Paper-Scissors This program is uncompleted. We knew we can compare each situations by r, p and s. But this is a definitely a hard work. So what I think is we need a function ( strcmp ) to compare the computerChoice and user’s choice directly. However, I tried to compare by using strcmp, but it doesn’t work well. In fact, I also find the function strcmp is also judge by number 1(true) or 0(false). But I have found some finished program by googling them. I saw and learned some solutions which others used. One of the solutions is we can use number substitute words. And we judge the results by adding them or minus them. We found that embedded loops works in this way, the first element loops in the first loop and the rest elements loop in the second one in turn. Embedded loops
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 11/17/2011.

Page1 / 3

Matlab 7 - Matlab 7 Loops within loops! Tian Gu ID:...

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

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