source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/extras/findrows.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 890 bytes
Line 
1function k = findrows(A, b)
2%FINDROWS Find indices of a given row within a matrix.
3%
4%   FINDROWS(A, B) returns a column vector with the indices of the rows
5%   in the matrix A that are identical to the row vector B.  If no rows
6%   in A are identical to B, an empty vector is returned.
7%
8%   The methods uses a for-loop, but it uses less memory and is in many
9%   cases a lot faster than the vectorized methods
10%
11%      find( all( A == repmat(b, size(A, 1), 1), 2 ) )
12%      find( all( A == b(ones(size(A, 1), 1),:), 2 ) )
13%
14%   See also FIND, FINDCOLS.
15
16%   Author:      Peter J. Acklam
17%   Time-stamp:  2002-03-03 13:51:15 +0100
18%   E-mail:      pjacklam@online.no
19%   URL:         http://home.online.no/~pjacklam
20
21if isempty(A)
22    k = [];
23    return
24end
25
26k = find( A(:,1) == b(1));
27top = size(A, 2);
28for j = 2:top
29    k = k(A(k,j) == b(j));
30    if isempty(k)
31        return
32    end
33end
Note: See TracBrowser for help on using the repository browser.