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