Mercurial > hg > octave-thorsten
comparison src/DLD-FUNCTIONS/find.cc @ 3369:f37ca3017116
[project @ 1999-11-21 16:26:02 by jwe]
author | jwe |
---|---|
date | Sun, 21 Nov 1999 16:26:08 +0000 |
parents | 38de16594cb4 |
children | ca92c9d3f882 |
comparison
equal
deleted
inserted
replaced
3368:a4cd1e9d9962 | 3369:f37ca3017116 |
---|---|
155 octave_value tmp (v, 1); | 155 octave_value tmp (v, 1); |
156 return find_to_fortran_idx (i_idx, j_idx, tmp, m_nr, nargout); | 156 return find_to_fortran_idx (i_idx, j_idx, tmp, m_nr, nargout); |
157 } | 157 } |
158 | 158 |
159 DEFUN_DLD (find, args, nargout, | 159 DEFUN_DLD (find, args, nargout, |
160 "find (X) or [I, J, V] = find (X): Return indices of nonzero elements") | 160 "-*- texinfo -*-\n\ |
161 @deftypefn {Loadable Function} {} find (@var{x})\n\ | |
162 Return a vector of indices of nonzero elements of a matrix. To obtain a\n\ | |
163 single index for each matrix element, Octave pretends that the columns\n\ | |
164 of a matrix form one long vector (like Fortran arrays are stored). For\n\ | |
165 example,\n\ | |
166 \n\ | |
167 @example\n\ | |
168 @group\n\ | |
169 find (eye (2))\n\ | |
170 @result{} [ 1; 4 ]\n\ | |
171 @end group\n\ | |
172 @end example\n\ | |
173 \n\ | |
174 If two outputs are requested, @code{find} returns the row and column\n\ | |
175 indices of nonzero elements of a matrix. For example,\n\ | |
176 \n\ | |
177 @example\n\ | |
178 @group\n\ | |
179 [i, j] = find (2 * eye (2))\n\ | |
180 @result{} i = [ 1; 2 ]\n\ | |
181 @result{} j = [ 1; 2 ]\n\ | |
182 @end group\n\ | |
183 @end example\n\ | |
184 \n\ | |
185 If three outputs are requested, @code{find} also returns a vector\n\ | |
186 containing the nonzero values. For example,\n\ | |
187 \n\ | |
188 @example\n\ | |
189 @group\n\ | |
190 [i, j, v] = find (3 * eye (2))\n\ | |
191 @result{} i = [ 1; 2 ]\n\ | |
192 @result{} j = [ 1; 2 ]\n\ | |
193 @result{} v = [ 3; 3 ]\n\ | |
194 @end group\n\ | |
195 @end example\n\ | |
196 @end deftypefn") | |
161 { | 197 { |
162 octave_value_list retval; | 198 octave_value_list retval; |
163 | 199 |
164 int nargin = args.length (); | 200 int nargin = args.length (); |
165 | 201 |