メモ1

#include "stdafx.h"
#include"iostream"
#include"math.h"
#include"fstream"//ファイル出力のコマンドofstreamを使うために使う。


using namespace System;
using namespace std;

int main(array<System::String ^> ^args)
{
ofstream outfile("test.dat");//ここでまず出力するファイルをつくる。txtとかでもできる
for(int i=0;i<100;i++)
{
outfile << sin((double)i*0.1) << endl;//てきとうにsincurveを出力。ちなみにendl;とは改行
}


ofstream pltfile("test.plt");//.pltとはgnuplotにプロットさせる命令を書くファイル。これをload "test.plt"とうつことでgnuplotはこれをプロットできる。
pltfile << "set xrange[0:10]" << endl;//xのプロットする領域をきめる
pltfile << "plot 'test.dat' " << endl;//test.datをプロットする
pltfile << "pause -1" << endl;


FILE *fp=_popen("pgnuplot.exe","w");

if(fp==NULL)
return -1;
fputs("load 'test.plt'",fp);
fflush(fp);
_pclose(fp);

return 0;

}

タグ:

+ タグ編集
  • タグ:

このサイトはreCAPTCHAによって保護されており、Googleの プライバシーポリシー利用規約 が適用されます。

最終更新:2009年06月30日 01:49