我正在使用Kinect
and 可以将跟踪坐标保存到文本文件中,但我需要为每个 X 和 Y 坐标添加水平(从左到右)的文本,以便绘制图形。目前,文本如下所示:
2:58:22 PM
Head X 314
Head Y 250
2:58:22 PM
Head X 314
Head Y 251
但我试图这样得到它:
2:58:22 PM 2:58:23 PM
Head X 1 2 3 4 5 6 7 8 9
Head Y 1 2 3 4 5 6 7 8 9
这是我保存到文本文件的代码:
StreamWriter sw = File.AppendText("Text.txt");
sw.WriteLine(DateTime.Now.ToLongTimeString());
sw.WriteLine("Head X " + "\t" + TextBox21.Text);
sw.WriteLine("Head Y " + "\t" + TextBox41.Text);
sw.WriteLine("Shoulder X" + "\t" + TextBox22.Text);
sw.WriteLine("Shoulder Y" + "\t" + TextBox42.Text);
sw.WriteLine("ShoulderLeft X" + "\t" + TextBox23.Text);
sw.WriteLine("ShoulderLeft Y" + "\t" + TextBox43.Text);
sw.WriteLine("ShoulderRight X" + "\t" + TextBox24.Text);
sw.WriteLine("ShoulderRight Y" + "\t" + TextBox44.Text);
sw.WriteLine("ElbowLeft X" + "\t" + TextBox25.Text);
sw.WriteLine("ElbowLeft Y" + "\t" + TextBox45.Text);
sw.WriteLine("ElbowRight X" + "\t" + TextBox26.Text);
sw.WriteLine("ElbowRight Y" + "\t" + TextBox46.Text);
sw.WriteLine("WristLeft X" + "\t" + TextBox27.Text);
sw.WriteLine("WristLeft Y" + "\t" + TextBox47.Text);
sw.WriteLine("WristRight X" + "\t" + TextBox28.Text);
sw.WriteLine("WristRight Y" + "\t" + TextBox48.Text);
sw.WriteLine("HandLeft X" + "\t" + TextBox29.Text);
sw.WriteLine("HandLeft Y" + "\t" + TextBox49.Text);
sw.WriteLine("HandRight X" + "\t" + TextBox30.Text);
sw.WriteLine("HandRight Y" + "\t" + TextBox50.Text);
sw.WriteLine("Spine X " + "\t" + TextBox31.Text);
sw.WriteLine("Spine Y " + "\t" + TextBox51.Text);
sw.WriteLine("HipCenter X" + "\t" + TextBox32.Text);
sw.WriteLine("HipCenter Y" + "\t" + TextBox52.Text);
sw.WriteLine("HipLeft X" + "\t" + TextBox33.Text);
sw.WriteLine("HipLeft Y" + "\t" + TextBox53.Text);
sw.WriteLine("HipRight X" + "\t" + TextBox34.Text);
sw.WriteLine("HipRight Y" + "\t" + TextBox54.Text);
sw.WriteLine("KneeLeft X" + "\t" + TextBox35.Text);
sw.WriteLine("KneeLeft Y" + "\t" + TextBox55.Text);
sw.WriteLine("KneeRight X" + "\t" + TextBox36.Text);
sw.WriteLine("KneeRight Y" + "\t" + TextBox56.Text);
sw.WriteLine("AnkleLeft X" + "\t" + TextBox37.Text);
sw.WriteLine("AnkleLeft Y" + "\t" + TextBox57.Text);
sw.WriteLine("AnkleRight X" + "\t" + TextBox38.Text);
sw.WriteLine("AnkleRight Y" + "\t" + TextBox58.Text);
sw.WriteLine("FootLeft X" + "\t" + TextBox39.Text);
sw.WriteLine("FootLeft Y" + "\t" + TextBox59.Text);
sw.WriteLine("FootRight X" + "\t" + TextBox40.Text);
sw.WriteLine("FootRight Y" + "\t" + TextBox60.Text);
sw.Close();