示例#1
0
        // write results to a text file
        private void saveResultsFile()
        {
            /* ----- write all of the raw trial data to a new file -------- */
            string rawFilename = "subj" + CogTest.uid + "speed.txt";

            System.IO.StreamWriter rawFile = new System.IO.StreamWriter(rawFilename);
            for (int i = 0; i < totalCompleted; i++)
            {
                string line = CogTest.uid + ',' + trials[i].trialNum.ToString() + ',' +
                              trials[i].reactTime.ToString() + ',' + CogTest.boolToChar(trials[i].correct);
                rawFile.WriteLine(line);
            }
            rawFile.Close();

            /* ----- append the summary data to speedSummary.txt -------- */
            System.IO.StreamWriter summaryFile = new System.IO.StreamWriter("speedSummary.txt", true);
            string summaryLine = CogTest.uid + ',' + totalCorrect.ToString() + ',' +
                                 totalCompleted.ToString() + ',' + mrtCorrect.ToString() + ',' + mrtIncorrect.ToString() + ',' +
                                 trtCorrect.ToString() + ',' + trtIncorrect.ToString();

            summaryFile.WriteLine(summaryLine);
            summaryFile.Close();
        }
示例#2
0
        // write results to a text file
        private void saveResultsFile()
        {
            /* ----- write all of the raw trial data to a new file -------- */
            string rawFilename = "subj" + CogTest.uid + "corsi.txt";

            System.IO.StreamWriter rawFile = new System.IO.StreamWriter(rawFilename);

            for (int i = 0; i < numTrials; i++)
            {
                string line = CogTest.uid + ',' + trials[i].spanLength.ToString() + ',' +
                              CogTest.boolToChar(trials[i].correct);
                rawFile.WriteLine(line);
            }
            rawFile.Close();

            /* ----- append the summary data to corsiSummary.txt -------- */
            System.IO.StreamWriter summaryFile = new System.IO.StreamWriter("corsiSummary.txt", true);
            string summaryLine = CogTest.uid + ',' + span3.ToString() + ',' + span4.ToString() + ',' +
                                 span5.ToString() + ',' + span6.ToString() + ',' + span7.ToString();

            summaryFile.WriteLine(summaryLine);
            summaryFile.Close();
        }