필터 지우기
필터 지우기

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

조회 수: 4 (최근 30일)
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?

채택된 답변

Philip Borghesani
Philip Borghesani 2017년 4월 13일
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
Slerotin
Slerotin 2017년 4월 13일
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!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Debugging and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by