source: trunk/src/set_param_input.m @ 1162

Last change on this file since 1162 was 1157, checked in by sommeria, 4 months ago

filter_time added

File size: 1.4 KB
Line 
1% set_param_input: set input parameters for transform functions
2%OUTPUT:
3% ParamOut: structure with parameter values
4%INPUT:
5% LisParam: list of parameter names (cell array)
6% DefaultValue: default values of the parameters in the absence of other input
7% ParamIn: default values set by the structure ParamIn
8
9
10function [ParamOut,errormsg] = set_param_input(ListParam,DefaultValue,ParamIn,Comment)
11ParamOut=[];
12errormsg=[];
13NbParam=numel(ListParam);
14if numel(DefaultValue)~=NbParam
15    errorsmsg='ERROR in set_param_input: the list of default values must have the same size as the list of parameters';
16    return
17end
18if ~exist('Comment','var')
19    Comment=cell(NbParam,1);
20end
21prompt=cell(NbParam,1);
22checknumeric=zeros(NbParam,1);
23for ilist=1:numel(ListParam)
24    if isfield(ParamIn,ListParam{ilist})
25        prompt{ilist}=ParamIn.(ListParam{ilist});
26    else
27        prompt{ilist}=DefaultValue{ilist};
28    end
29    if isnumeric(prompt{ilist})
30        checknumeric(ilist)=1;
31        prompt{ilist}=num2str(prompt{ilist});
32    end
33end
34dlg_title = 'get the input parameters';
35options.Resize='on';
36answer = inputdlg(ListParam,dlg_title,NbParam,prompt,options);
37%answer = msgbox_uvmat('INPUT_TXT',ListParam);
38if isempty(answer)
39    return
40end
41for ilist=1:NbParam
42    if checknumeric(ilist)
43        answer{ilist}=str2num(answer{ilist});
44    end
45    ParamOut.(ListParam{ilist})=answer{ilist};
46end
47 
Note: See TracBrowser for help on using the repository browser.