Changeset 979 for applications/bdmtoolbox/mex
- Timestamp:
- 05/25/10 20:55:06 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/bdmtoolbox/mex/estimator.cpp
r966 r979 38 38 Execute command: 39 39 \code 40 >> estimator ('config_file.cfg');40 >> estimator 41 41 \endcode 42 when using loggers storing results on hard drives, and 43 \code 44 >> Res=estimator('config_file.cfg'); 45 \endcode 46 when using logger of the type \c "mex_logger". The results will be stored in structure \c M. 42 and follow the help there. 47 43 48 44 */ … … 69 65 // Check the number of inputs and output arguments 70 66 if ( n_input<2 ) mexErrMsgTxt ( "Usage:\n" 71 " result=estimator(system, estimators, experiment, logger)\n"67 "[Res,estimators,Res2]=estimator(system, estimators, experiment, logger)\n" 72 68 " system = struct('class','datasource',...); % Estimated system\n" 73 69 " estimators = {struct('class','estimator',...), % Estimators\n" … … 76 72 " experiment = struct('ndat',10); % number of data in experiment, full length of finite datasources, 10 otherwise \n" 77 73 " logger = struct('class','mexlogger'); % How to store results, default=mexlog, i.e. matlab structure\n\n" 74 "Output:\n" 75 " Res Matlab structure with logged results, \n" 76 " estimators Array of estimators updated with data \n" 77 " Res2 When logfull log_level is on, this structure is filled with structures of posterior densities\n\n" 78 78 "see documentation of classes datasource, BM, and mexlogger and their offsprings in BDM." ); 79 79 … … 206 206 if ( n_output<1 ) mexErrMsgTxt ( "Wrong number of output variables!" ); 207 207 output[0] = mL->toCell(); 208 if (n_output>1) { 208 if (n_output>1){ // write estimators 209 UImxArray Ests; 210 UI::save(Es, Ests,"estimators"); 211 output[1]=UImxArray::create_mxArray(Ests); 212 } 213 if (n_output>2) { 209 214 mL->_setting_conf().setAutoConvert(true); 210 output[ 1]= UImxArray::create_mxArray(mL->_setting_conf().getRoot());215 output[2]= UImxArray::create_mxArray(mL->_setting_conf().getRoot()); 211 216 } 212 217 } 213 218 #endif 214 219 for (int i=0;i<Dls.length(); i++){delete Dls(i); delete Dlsc(i);} 220 UIFile F; 221 UI::save(Es, F.getRoot(),"estimators"); 222 F.writeFile("estim_out.cfg"); 215 223 }