Hi!
Look at the commands
fopen
fprintf
fclose
to write to a file. You may use the open/close commands before/after the loop and the fprintf command inside the loop.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!