// Use this for initialization void Start() { myo = FindObjectOfType <ThalmicMyo>(); // Debug.Log(myo); emg = myo.GetEMGData(); Debug.Log(emg.Count()); }
// Update is called once per frame void Update() { emg = myo.GetEMGData(); // Debug.Log(emg.Count()); if (emg.Count() >= 8) { counter = 0; foreach (int item in emg) { str += item + "\t"; textStr[counter] = item.ToString(); counter++; } } if (canStream) { text1.text = textStr[0]; text2.text = textStr[1]; text3.text = textStr[2]; text4.text = textStr[3]; text5.text = textStr[4]; text6.text = textStr[5]; text7.text = textStr[6]; text8.text = textStr[7]; // open file StreamWriter sw = new StreamWriter("emgData3.txt", true); // write str to xml/txt file sw.WriteLine(str); // close file sw.Close(); StartCoroutine(CD()); } str = ""; }