source: trunk/src/set_param_input.m @ 1189

Last change on this file since 1189 was 1189, checked in by sommeria, 22 hours ago

introduced creator of xml for PCO multitif

File size: 1.3 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,Title)
11ParamOut=[];
12errormsg=[];
13NbParam=numel(ListParam);
14if numel(DefaultValue)~=NbParam
15    errormsg='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('Title','var')
19    Title='get the input parameters';
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
34options.Resize='on';
35options.WindowStyle='normal';
36answer = inputdlg(ListParam,Title,1,prompt,options);
37if isempty(answer)
38    return
39end
40for ilist=1:NbParam
41    if checknumeric(ilist)
42        answer{ilist}=str2num(answer{ilist});
43    end
44    ParamOut.(ListParam{ilist})=answer{ilist};
45end
46 
Note: See TracBrowser for help on using the repository browser.