# Math Help - find out if a variable is vector

1. ## find out if a variable is vector

hello!
do u have any idea, what condition to put in MATLAB in order to find out whether a variable x is vector or not? i have tried to put: if x==x( , but it always shows affirmative.
Thank you....

2. Originally Posted by inzaghina
hello!
do u have any idea, what condition to put in MATLAB in order to find out whether a variable x is vector or not? i have tried to put: if x==x( , but it always shows affirmative.
Thank you....
Use " size(x) == (1,1)".

3. thanks.also i found : if length(x)==1 .

4. Originally Posted by inzaghina
thanks.also i found : if length(x)==1 .
Yes that works too... I generally tend to use size(), since it can tell me the exact dimensions...
length() cant distinguish between row and column vector

5. yes yes
another question: how i see if a variable is integer ?

6. Originally Posted by inzaghina
yes yes
another question: how i see if a variable is integer ?
Do you mean: How do I tell if a variable is an integer data type? ">help isinteger".

or: How do I tell if a float type is holding an exact integer? ">floor(x)==x"

CB

7. yes. the first one was helpful .
and now, one more question : how do i resize a vector ?
ty

8. Originally Posted by inzaghina
yes. the first one was helpful .
and now, one more question : how do i resize a vector ?
ty
>help reshape

CB