How can I save only one piece of data from the command window to a file?
조회 수: 1 (최근 30일)
이전 댓글 표시
I am running a script to reject artifacts and I want to collate the number of rejections over each block/subject (there are a lot) into a single document. Besides doing it manually, is there a way to pull just the one number I want from each iteration into a file? This is what the output of one block from the function looks like in the command window:
detected 36 zvalue artifacts rejected 33 trials completely rejected 0 trials partially resulting 47 trials
For some reason the number of rejected trials aren't in any .mat file output, so basically I want an output that for every subject/block gives me: Rejected X trials completely
Thank you!
댓글 수: 0
채택된 답변
Iain
2014년 2월 11일
Before your loop:
fid = fopen(filename,'w');
In the loop:
fwrite(fid,['Rejected ' num2str(rejected) ' trials, and some more random text and variable to illustrate ' num2str(5) 10 13],'uint8');
After the loop
fclose(fid)
Then, open the file in a text editor. fprintf can be used instead of fwrite.
Alternatively, just log the answer to a result vector: Before the loop:
results = [];
In the loop:
results(end+1) = rejected;
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Whos에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!