Filter löschen
Filter löschen

Text from script appears in command window

16 Ansichten (letzte 30 Tage)
Colin Raymond
Colin Raymond am 10 Jan. 2020
Kommentiert: Colin Raymond am 14 Jan. 2020
Recently Matlab has been having an odd glitch: when I call scripts, sections of text from those scripts appear in the command window, often repeated again and again (as when the script is going through a loop). This is harmless in that it doesn't affect the processing of the scripts, but frustrating when I want to have some output visible in the command window and it is filled with thousands of lines of code!
For instance, if I run a sample file, the command window looks like this:
>> samplefile
%This is a sample file
%It doesn't really do anything
a=[6 2 3];
b=[3 4 4];
result=a+b;
disp(result);disp(clock);
9 6 7
2020 1 10 14 47 9.4269
I've checked that diary is off, but other than that am not sure what to check or reset to stop this from happening.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 10 Jan. 2020
  4 Kommentare
Stephen23
Stephen23 am 14 Jan. 2020
A simple way to find where the extraneous echo call is to temporarily shadow it with a function that throws an error.
Colin Raymond
Colin Raymond am 14 Jan. 2020
Using dbstop (very useful) and a test script to check whether echo is on or off led me to find that the issue can be traced to the ncgeodataset object (in the nctoolbox library). Interestingly, none of these scripts leave echo on, so far as I can tell, and also calling ncgeodataset itself isn't the problem, but rather it happens when a variable is called from a file that was created using ncgeodataset. So
file=ncgeodataset('weatherdata.grib');
results in echo staying off, but
thisvar=file{'2_metre_temperature'};
results in echo on. Following each such statement with
echo off
therefore solves the problem (though not quite explaining it!). Thanks all for the assistance.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Programming Utilities finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by