Why is my code echoing in the command window after the first line with curly braces?

1 visualización (últimos 30 días)
I noticed that a script that I wrote started to echo in the Command Window for no apparent reason. Although I don't know why it is doing this, I can tell you that the echoing starts with the line immediately after any line with curly braces {} in the it. To suppress it, I've written "; echo off;" at the end of every line like so:
ww3_grib = ['multi_reanal.glo_30m_ext.',ww3_parameter,'.',num2str(ww3_year),string_month,'.grb2'];
ww3_nco = ncgeodataset(ww3_grib);
ww3_variables = ww3_nco.variables;
ww3_param_values = ww3_nco{ww3_param}(1,:,:); echo off;
ww3_time = ww3_nco{'time'}(:); echo off;
ww3_lon = ww3_nco{'lon'}(:); echo off;
ww3_lat = ww3_nco{'lat'}(:); echo off;
ww3_param_size = size(ww3_nco{ww3_param}); echo off;
This alleviates the problem. The only problem now is that I don't know why this occurred (and I'm curious about things like this). Does anyone know why this occurs? Has this happened to anyone else?

Respuesta aceptada

Philip Borghesani
Philip Borghesani el 13 de Abr. de 2017
Remove your echo off commands and enter " dbstop in echo" then run your code or type a line that causes echo. I expect there is a subsref overload in an object (ncgeodataset?) that is calling echo on or a function that is calling echo on.
  1 comentario
Slerotin
Slerotin el 13 de Abr. de 2017
I added "dbstop in echo" above the lines with curly braces and removed each instance of "echo off;".
When I ran the small portion of the code that I'm using to test this, the 'ncgeodataset.m' file opened up in the editor. A small arrow pointed to the first line of code I've got with curly braces (in my code). Another arrow pointed to a line that said "echo off" in 'ncgeodataset.m'. In 'ncgeodataset.m' the section of code containing the "echo off" is labeled as "CFDATASET.NUMEL Overridden function required for supporting SUBSREF" so it must be what you're saying.
I'll do some research on what a subsref overload is (as well as figure out how to use dbstop). Thank you!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Communications Toolbox 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!

Translated by