Changeset 895 for library/bdm/mex/mex_datasource.h
- Timestamp:
- 04/08/10 16:01:03 (14 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
library/bdm/mex/mex_datasource.h
r766 r895 45 45 rowid = linspace ( 0, Data.rows() - 1 ); 46 46 dtsize = rowid.length(); 47 ytsize = rowid.length();48 47 utsize = 0; 49 48 … … 87 86 mexDS () : DS() {}; 88 87 89 /*! \brief Create memory data source from mxArray88 /*! \brief Data source computed by matlab function 90 89 91 90 \code … … 94 93 step_name=""; // name of function to call 95 94 input_name=""; // name of workspace variable where inputs are written 96 yrv = {class='RV',...} // identification of outputs95 drv = {class='RV',...} // identification of outputs 97 96 urv = {class='RV',...} // identification of inputs 98 97 }; … … 106 105 UI::get ( input_name, set, "input_name", UI::compulsory ); 107 106 108 shared_ptr<RV> r y = UI::build<RV> ( set, "yrv", UI::compulsory );107 shared_ptr<RV> rd = UI::build<RV> ( set, "drv", UI::compulsory ); 109 108 shared_ptr<RV> ru = UI::build<RV> ( set, "urv", UI::compulsory ); 110 109 111 ytsize = ry->_dsize();110 dtsize = rd->_dsize(); 112 111 utsize = ru->_dsize(); 113 dtsize = ytsize + utsize;114 112 115 set_drv ( *r y, *ru );113 set_drv ( *rd, *ru ); 116 114 validate(); 117 115 } … … 142 140 mexCallMATLAB ( 1, &tmp, 0, ( mxArray ** ) &dummy, step_name.c_str() ); 143 141 // save its results 144 bdm_assert_debug ( ( int ) mxGetM ( tmp ) == ytsize || ( int ) mxGetN ( tmp ) == ytsize, "mexDS.step() expected return vector of length " + num2str ( dtsize ) +142 bdm_assert_debug ( ( int ) mxGetM ( tmp ) == dtsize || ( int ) mxGetN ( tmp ) == dtsize, "mexDS.step() expected return vector of length " + num2str ( dtsize ) + 145 143 "got vector " + num2str ( ( int ) mxGetM ( tmp ) ) + "x" + num2str ( ( int ) mxGetN ( tmp ) ) ); 146 144 //write y 147 145 dt.set_subvector ( 0, mxArray2vec ( tmp ) ); 148 146 //write u 149 dt.set_subvector ( ytsize, ut );150 147 } 151 148 void write ( const vec &ut0 ) {