How can I save only one piece of data from the command window to a file?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Mikael
el 11 de Feb. de 2014
Comentada: Mikael
el 11 de Feb. de 2014
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 comentarios
Respuesta aceptada
Iain
el 11 de Feb. de 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;
Más respuestas (0)
Ver también
Categorías
Más información sobre Whos en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!