サンプルデータ作成用Sketch
時々必要になるたびに書き直してるので、メモ書き。
0列目は0-LineCountの値で、1列目以降は乱数
LineCountは行数
DataCountは列数
MaxValueは乱数の上限値
Secondは更新間隔
で、この辺いじくるといろいろできるはず。
int LineCount = 360; int DataCount = 5; int MaxValue = 100; float Second = 1; boolean Redraw = true; void setup() { frameRate(1/Second); size(300,300); background(0); } void draw() { WriteFile(); DrawView(); } void WriteFile() { String[] line = new String[LineCount]; for(int l = 0; l<LineCount;l++){ String data = ""; for(int i = 0; i < DataCount; i++){ float d = l; if(i != 0){ d = int(random(MaxValue)); } data += d; if(i != DataCount){ data += ","; } } line[l] = data; } saveStrings("file.csv", line); } void DrawView() { if(Redraw == true){ background(255); }else{ background(0); } Redraw = !Redraw; } void stop() { }
できあがるCSVはこんな感じ
ファイル掴まないので使い勝手が良いのと、n秒おきっていうのが楽でいいかんじ。