ivan@78
|
1 function option = setopt(opt_par,default);
|
ivan@78
|
2 % option = setopt(opt_par,default);
|
ivan@78
|
3 %
|
ivan@78
|
4 % SETOPT can modify a default option vector with user specified options.
|
ivan@78
|
5 %
|
ivan@78
|
6 % Input:
|
ivan@78
|
7 % opt_par : Users desired option vector
|
ivan@78
|
8 % default : Program default option vector
|
ivan@78
|
9 %
|
ivan@78
|
10 % Output:
|
ivan@78
|
11 % option : New option vector
|
ivan@78
|
12 %
|
ivan@78
|
13 % Example:
|
ivan@78
|
14 % opt_par = [1 2 3 4];
|
ivan@78
|
15 % default = [1 1 1 1];
|
ivan@78
|
16 % option = setopt(opt_par,default)
|
ivan@78
|
17 % option = 1 2 3 4
|
ivan@78
|
18 %
|
ivan@78
|
19
|
ivan@78
|
20 %File Name: setopt.m
|
ivan@78
|
21 %Last Modification Date: 10/26/95 13:06:18
|
ivan@78
|
22 %Current Version: setopt.m 2.4
|
ivan@78
|
23 %File Creation Date: Thu Nov 11 10:40:22 1993
|
ivan@78
|
24 %Author: Jan Erik Odegard <odegard@ece.rice.edu>
|
ivan@78
|
25 %
|
ivan@78
|
26 %Copyright (c) 2000 RICE UNIVERSITY. All rights reserved.
|
ivan@78
|
27 %Created by Jan Erik Odegard, Department of ECE, Rice University.
|
ivan@78
|
28 %
|
ivan@78
|
29 %This software is distributed and licensed to you on a non-exclusive
|
ivan@78
|
30 %basis, free-of-charge. Redistribution and use in source and binary forms,
|
ivan@78
|
31 %with or without modification, are permitted provided that the following
|
ivan@78
|
32 %conditions are met:
|
ivan@78
|
33 %
|
ivan@78
|
34 %1. Redistribution of source code must retain the above copyright notice,
|
ivan@78
|
35 % this list of conditions and the following disclaimer.
|
ivan@78
|
36 %2. Redistribution in binary form must reproduce the above copyright notice,
|
ivan@78
|
37 % this list of conditions and the following disclaimer in the
|
ivan@78
|
38 % documentation and/or other materials provided with the distribution.
|
ivan@78
|
39 %3. All advertising materials mentioning features or use of this software
|
ivan@78
|
40 % must display the following acknowledgment: This product includes
|
ivan@78
|
41 % software developed by Rice University, Houston, Texas and its contributors.
|
ivan@78
|
42 %4. Neither the name of the University nor the names of its contributors
|
ivan@78
|
43 % may be used to endorse or promote products derived from this software
|
ivan@78
|
44 % without specific prior written permission.
|
ivan@78
|
45 %
|
ivan@78
|
46 %THIS SOFTWARE IS PROVIDED BY WILLIAM MARSH RICE UNIVERSITY, HOUSTON, TEXAS,
|
ivan@78
|
47 %AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
|
ivan@78
|
48 %BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
ivan@78
|
49 %FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RICE UNIVERSITY
|
ivan@78
|
50 %OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
ivan@78
|
51 %EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
ivan@78
|
52 %PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
ivan@78
|
53 %OR BUSINESS INTERRUPTIONS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
ivan@78
|
54 %WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
ivan@78
|
55 %OTHERWISE), PRODUCT LIABILITY, OR OTHERWISE ARISING IN ANY WAY OUT OF THE
|
ivan@78
|
56 %USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
ivan@78
|
57 %
|
ivan@78
|
58 %For information on commercial licenses, contact Rice University's Office of
|
ivan@78
|
59 %Technology Transfer at techtran@rice.edu or (713) 348-6173
|
ivan@78
|
60 %
|
ivan@78
|
61 %Change History:
|
ivan@78
|
62 %
|
ivan@78
|
63
|
ivan@78
|
64 if (nargin < 2)
|
ivan@78
|
65 error('You need two inputs');
|
ivan@78
|
66 end;
|
ivan@78
|
67 len = length(opt_par);
|
ivan@78
|
68 option = zeros(size(default));
|
ivan@78
|
69 option(1:len) = opt_par(1:len);
|
ivan@78
|
70 option = option + (option == 0).*default;
|