Show
Ignore:
Timestamp:
06/22/09 13:17:49 (15 years ago)
Author:
smidl
Message:

merging works for merger_mx

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • applications/bdmtoolbox/mex/merger_mx.cpp

    r393 r395  
    8383        Merger->set_sources(Sources,true); // takes care of deletion of sources 
    8484        Merger->merge(); 
    85          
     85 
     86        mxArray* tmp ; 
    8687        // Save results 
    8788        if (n_output>0){ 
    88                 mxArray* tmp = mxCreateStructMatrix(1,1,0,NULL); 
     89                tmp = mxCreateStructMatrix(1,1,0,NULL); 
    8990                //support 
    9091                Array<vec> &samples=Merger->_Smp()._samples(); 
     
    100101                vec2mxArray(w,fldw); 
    101102                mxReplaceFieldNM(tmp, "weights", fldw); 
    102                  
     103 
     104                // sources 
     105                                char srcstr[20]; 
     106                for (int i=0;i<Sources.length();i++){ 
     107                        sprintf(srcstr,"source%d",i+1); 
     108                        vec sll=exp(Sources(i)->evallogcond_m(Merger->_Smp()._samples(),vec(0))); 
     109 
     110                        mxArray* fldw=mxCreateDoubleMatrix(1, sll.length(), mxREAL); 
     111                        vec2mxArray(sll/sum(sll),fldw); 
     112                        mxReplaceFieldNM(tmp, srcstr, fldw); 
     113                }                
     114 
    103115                output[0] = tmp; 
    104116        }