Date: Nov 19, 2012 8:52 PM
Author: Rajasekhara Madhusudan Narayana Bhatla
Subject: Vector comparison using if
I'm sought of new using matlab. I've a situation where I've to assign a variable 2 different values based on how the values in vector
it is something like.
i.e, my Y will also be a vector whose value depends on where I x is. if x is <2 then y is x^2 if not it is a constant.
I'm not sure how to do this.
i tried it with if any(x)<2 but I then i realized that it is not correct. since I want for all values of x<2 Y=x^2 and all values of x >2 x = 4.