Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2004
    Location
    Indiana
    Posts
    1,205

    Any Matlab folks over here?

    I am having an issue with the code for one of my scripts and so I need some help.

    I have two vectors, teamNum and timeLoc. timeLoc refers to row numbers (line numbers) on teamNum.

    Here is teamNum:
    1
    1
    1
    2
    2
    2
    3
    3
    3
    4
    4
    4
    5
    5
    5
    6
    6
    6


    Here is timeLoc:

    8
    15


    Here is the line of code I'm having trouble with: find(teamNum(timeLoc) == teamNum)

    I want to find the number at lines 8 and 15 within the teamNum vector, which is teams 3 and 5. From there, I want to find out which lines they occur on because they occur on more than one line.

    When I try running that, I get this error: Matrix dimensions must agree.

    Any ideas?
    Ankit Gupta - Cernax Hosting
    "We're always second in the industry, the customer comes first."

  2. #2
    Join Date
    Dec 2005
    Posts
    397
    Given my MATLAB knowledge isnt wonderful, but is it possible where timeLock is you need to have separate lines for each row

    ex.
    find(teamNum==teamNum(8))
    find(teamNum==teamNum(15))

    or

    for h = 1:length(timeLoc)
    find(teamNum
    ==teamNum(h))
    end
    Last edited by BostonGuru; 10-20-2006 at 12:58 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •