Results 1 to 8 of 8

Math Help - find out if a variable is vector

  1. #1
    Newbie
    Joined
    Nov 2007
    Posts
    22

    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....
    Last edited by inzaghina; May 23rd 2009 at 10:54 AM. Reason: .
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Lord of certain Rings
    Isomorphism's Avatar
    Joined
    Dec 2007
    From
    IISc, Bangalore
    Posts
    1,465
    Thanks
    6
    Quote Originally Posted by inzaghina View Post
    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)".
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Nov 2007
    Posts
    22
    thanks.also i found : if length(x)==1 .
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Lord of certain Rings
    Isomorphism's Avatar
    Joined
    Dec 2007
    From
    IISc, Bangalore
    Posts
    1,465
    Thanks
    6
    Quote Originally Posted by inzaghina View Post
    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
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Nov 2007
    Posts
    22
    yes yes
    another question: how i see if a variable is integer ?
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by inzaghina View Post
    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
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Newbie
    Joined
    Nov 2007
    Posts
    22
    yes. the first one was helpful .
    and now, one more question : how do i resize a vector ?
    ty
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by inzaghina View Post
    yes. the first one was helpful .
    and now, one more question : how do i resize a vector ?
    ty
    >help reshape

    CB
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 10
    Last Post: January 11th 2011, 11:42 AM
  2. Replies: 8
    Last Post: January 11th 2011, 10:17 AM
  3. Replies: 2
    Last Post: January 27th 2010, 08:23 PM
  4. Replies: 11
    Last Post: December 23rd 2009, 01:30 AM
  5. Replies: 2
    Last Post: October 5th 2009, 03:25 PM

Search Tags


/mathhelpforum @mathhelpforum