当前位置: 首页>>代码示例>>C++>>正文


C++ realvec::write方法代码示例

本文整理汇总了C++中realvec::write方法的典型用法代码示例。如果您正苦于以下问题:C++ realvec::write方法的具体用法?C++ realvec::write怎么用?C++ realvec::write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在realvec的用法示例。


在下文中一共展示了realvec::write方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setfill

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);
    }
  }
}
开发者ID:sanyaade-teachings,项目名称:marsyas,代码行数:86,代码来源:PlotSink.cpp


注:本文中的realvec::write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。