if this AND that then...

How do I say something like if value1 = 1 and value2 = 1 then... I'm trying to say that is something is a color and there is an arrow in a particular location then it will change the WaitSecs(value). This is what I have so far, but I'm not sure if that is saying what I intend it to.
if colour1 = c1
if tri1 = downtri
(keyCode(1,100)) == 1; %left
Screen('FillRect',window,[0 0 0])
Screen('Flip',window)
WaitSecs(tar);
elseif...
Thanks, you guys make my life WAY easier.

1 Comment

Jan
Jan on 28 Nov 2012
Edited: Jan on 30 Nov 2012
(keyCode(1,100)) == 1; This is a comparison between the 100th element of a vector and 1. The output of the result is suppressed. Not really useful.

Sign in to comment.

 Accepted Answer

if colour1 == c1 && tri1 == downtri
(keyCode(1,100)) == 1; %left
Screen('FillRect',window,[0 0 0])
Screen('Flip',window)
WaitSecs(tar);

4 Comments

Brett
Brett on 28 Nov 2012
I get an error that says "operators must be convertible to logical scalar values." Any idea how to fix it?
One of those terms must be an array, not a single scalar number. Fix that, or else use any() or all().
I changed it into scalar values, now it works. :)
if q1tri == 1 && q1col == 1 && keyCode(1,98) == 1 %down
Screen('FillRect',window,[0 0 0])
Screen('Flip',window)
WaitSecs(tar);
OK great - go ahead and mark this question as "Answered" then.

Sign in to comment.

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!