How to stop script from displaying results in the Editor window?
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I'm working on script files for a course and when I run my file, all the results from disp and fprintf are being displayed in the command window, as well as the editor window as such:
*%Messages about average distance
if Avg_Distance<POOL_CENTER;
disp('Average distance is too short');
end
if Avg_Distance>POOL_CENTER;
disp('Average distance is too long');
end
%CODE ENDS HERE
Average distance: 13.46
Average distance is too short*
%UNWANTED DISPLAY ^^^
When I run this code, the "disp('Average distance is too short')" is displaying at the bottom of the code in my editor window. Furthermore, when I attempt to run the code a second time, the results displayed in the editor window cause an error message that doesn't allow my file to run.
How can I force the results to only display in the command window, and not in the editor window? My grade is in your hands.
Thanks,
Concerned student.
9 Commenti
Risposta accettata
Guillaume
il 12 Mar 2015
You must have set the diary to output to your m file with:
diary('Lab05.m')
somewhere, although I can't see that command in your code. Furthermore, in Matlab's editor preferences, you must have set matlab to reload silently unedited files that have been modified outside the editor (maybe it's the default. I have it turned off).
0 Commenti
Più risposte (1)
Brendan Hamm
il 12 Mar 2015
Modificato: Brendan Hamm
il 12 Mar 2015
I notice a diary off at the end of your script, this implies that you have turned the diary on at the beginning. You may want to change the filename for the diary so it stores to another file:
diary('myDiary.txt')
% all your code
diary off
Vedere anche
Categorie
Scopri di più su Debugging and Analysis 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!




