void PlotSink::myProcess(realvec& in, realvec& out) { out = in; mrs_natural t,o; //if using MATLABengine, plot the input data in MATLAB #ifdef MARSYAS_MATLAB if(ctrl_matlab_->isTrue()) { MATLAB_PUT(in, type_+"_"+name_+"_indata") MATLAB_EVAL(ctrl_matlabCommand_->to<mrs_string>()); } #endif counter_++; if (ctrl_sequence_->isTrue()) { //save current input to a sequence of numbered output files ostringstream oss; oss << ctrl_filename_->to<mrs_string>() << setfill('0') << setw(4) << counter_ << ".plot"; cout << "name = " << name_ << " " << oss.str() << endl; MRSMSG("Writing " << oss.str() << endl); in.write(oss.str()); } if (ctrl_single_file_->isTrue()) { for (o=0; o < inObservations_; o++) { for (t = 0; t < inSamples_; t++) { //(*single_file_) << counter_ << " " << t << " "; (*single_file_) << std::setprecision(20) << in(o,t); (*single_file_) << std::endl; //cout << in(o,t); } } if (ctrl_no_ticks_->isTrue()) { } else { (*single_file_) << std::endl; } } if(ctrl_messages_->isTrue()) { mrs_string sep =ctrl_separator_->to<mrs_string>(); //ostringstream oss; //output input content as a Marsyas Message (stdout by default) // for (t = 0; t < inSamples_; t++) // { // for (o=0; o < inObservations_; o++) // { // if (o < inObservations_ - 1) // { // oss << out(o,t) << sep; // } // else // { // oss << out(o,t); // } // } // mrs_string s = oss.str(); // MRSMSG(s << endl); // }//FIXME: confirm that code below is correct and remove commented code above for (o=0; o < inObservations_; o++) { ostringstream oss; for (t = 0; t < inSamples_; t++) { if (t < inSamples_ - 1) { oss << out(o,t) << sep; } else { oss << out(o,t); } } mrs_string s = oss.str(); MRSMSG(s << endl); } } }