How can I save only one piece of data from the command window to a file?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Iain
il 11 Feb 2014
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;
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Whos in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!