Mercurial > hg > octave-nkf
annotate scripts/general/deal.m @ 19669:c2031ad6dbe7
Fix octave header includes in audiodevinfo
* audiodevinfo.cc: change includes to use local octave headers
author | Vytautas Jančauskas <unaudio@gmail.com> |
---|---|
date | Wed, 11 Sep 2013 21:32:14 +0300 |
parents | f3d52523cde1 |
children | d63878346099 |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
1 ## Copyright (C) 1998-2012 Ariel Tankus |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2 ## |
4818 | 3 ## This file is part of Octave. |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
4818 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
4818 | 18 |
19 ## -*- texinfo -*- | |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
7017
diff
changeset
|
20 ## @deftypefn {Function File} {[@var{r1}, @var{r2}, @dots{}, @var{rn}] =} deal (@var{a}) |
6714 | 21 ## @deftypefnx {Function File} {[@var{r1}, @var{r2}, @dots{}, @var{rn}] =} deal (@var{a1}, @var{a2}, @dots{}, @var{an}) |
4818 | 22 ## |
23 ## Copy the input parameters into the corresponding output parameters. | |
24 ## If only one input parameter is supplied, its value is copied to each | |
25 ## of the outputs. | |
26 ## | |
27 ## For example, | |
28 ## | |
29 ## @example | |
30 ## [a, b, c] = deal (x, y, z); | |
31 ## @end example | |
32 ## | |
33 ## @noindent | |
34 ## is equivalent to | |
35 ## | |
36 ## @example | |
37 ## @group | |
38 ## a = x; | |
39 ## b = y; | |
40 ## c = z; | |
41 ## @end group | |
42 ## @end example | |
43 ## | |
44 ## @noindent | |
45 ## and | |
46 ## | |
47 ## @example | |
48 ## [a, b, c] = deal (x); | |
49 ## @end example | |
50 ## | |
51 ## @noindent | |
52 ## is equivalent to | |
53 ## | |
54 ## @example | |
55 ## a = b = c = x; | |
56 ## @end example | |
57 ## @end deftypefn | |
58 | |
59 ## Author: Ariel Tankus | |
60 ## Author: Paul Kienzle and Etienne Grossman | |
61 ## Created: 13.11.98 | |
62 ## Adapted-by: jwe | |
63 | |
64 function [varargout] = deal (varargin) | |
65 | |
66 if (nargin == 0) | |
6046 | 67 print_usage (); |
4819 | 68 elseif (nargin == 1 || nargin == nargout) |
4820 | 69 varargout(1:nargout) = varargin; |
4818 | 70 else |
71 error ("deal: nargin > 1 and nargin != nargout"); | |
72 endif | |
73 | |
74 endfunction | |
4819 | 75 |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
76 |
4819 | 77 %!test |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
78 %! [a,b] = deal (1,2); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
79 %! assert (a, 1); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
80 %! assert (b, 2); |
4819 | 81 %!test |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
82 %! [a,b] = deal (1); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
83 %! assert (a, 1); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
84 %! assert (b, 1); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
85 |