How to stop script from displaying results in the Editor window?

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 件のコメント

Guillaume
Guillaume 2015 年 3 月 12 日
That is a very unusual behaviour.
The only way I could think of doing this by design would be to modify the default disp and fprintf to force them to write to the editor using undocumented methods of matlab.desktop.editor. It's not something that would happen by accident.
Can you post a screenshot of your matlab environment?
Troy Beckham
Troy Beckham 2015 年 3 月 12 日
I can't at the moment. However I start with several lines of code and after its run, the results are printed at the bottom of the code. Are you familiar with what settings are causing this?
Guillaume
Guillaume 2015 年 3 月 12 日
As far as I know there's no built-in way, even by toggling preferences, to do what you report in matlab.
Stephen23
Stephen23 2015 年 3 月 12 日
編集済み: Stephen23 2015 年 3 月 12 日
Can you please upload a screenshot of this. Even better would be two screenshots: the freshly started MATLAB, and after you have called/run your file.
Troy Beckham
Troy Beckham 2015 年 3 月 12 日
Troy Beckham
Troy Beckham 2015 年 3 月 12 日
Troy Beckham
Troy Beckham 2015 年 3 月 12 日
Troy Beckham
Troy Beckham 2015 年 3 月 12 日
Before running:
Troy Beckham
Troy Beckham 2015 年 3 月 12 日
After running:

サインインしてコメントする。

 採用された回答

Guillaume
Guillaume 2015 年 3 月 12 日

0 投票

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).

その他の回答 (1 件)

Brendan Hamm
Brendan Hamm 2015 年 3 月 12 日
編集済み: Brendan Hamm 2015 年 3 月 12 日

0 投票

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

1 件のコメント

Troy Beckham
Troy Beckham 2015 年 3 月 12 日
I eliminated the diary command all together and it seems to have fixed the problem, thank you for your help.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeDebugging and Analysis についてさらに検索

質問済み:

2015 年 3 月 12 日

回答済み:

2015 年 3 月 12 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by