root/library/mex/mexds.h @ 314

Revision 314, 1.0 kB (checked in by smidl, 15 years ago)

mexDS correction + new buildmex

Line 
1#include "../bdm/stat/libDS_ui.h"
2
3/*! \brief Create memory data source from mxArray
4
5\code
6system={
7        type="mexDS";
8        varname="";            // name of workspace variable
9        rids=[1 1 1];          // numbers of data rows
10        tds =[0 1 2];          // time delays
11        };
12\endcode
13
14MemDS with the above fields will be created;
15
16\todo Very memory inefficient implementation. The data file is copied 2 times!
17For better implementatin we would need MemDS with pointer to the raw data. Then it could operate directly inside mxArray.
18
19*/
20class UImexDS: public UIbuilder{
21        public:
22                UImexDS():UIbuilder("mexDS"){};
23                bdmroot* build(Setting &S) const{
24                        mat Data;
25                        ivec rids;
26                        ivec tds;
27                        try{
28                                Data = mxArray2mat(mexGetVariable("base",S["varname"]));
29                                rids=getivec(S["rids"]);
30                                tds = getivec(S["tds"]);
31                        }
32                        catch UICATCH ;
33                       
34                        MemDS* M=new MemDS(Data,rids,tds);
35                        RV* r; UIbuild(S["rv"],r);
36                        RV ru=RV();
37                        M->set_rvs(*r,ru);
38                        return M;
39                };
40};
41UIREGISTER(UImexDS);
Note: See TracBrowser for help on using the browser.