Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
supressing output; how to find where it occurs?

Subject: supressing output; how to find where it occurs?

From: Godzilla

Date: 14 Aug, 2013 18:38:07

Message: 1 of 3

I have code with many scripts and sometimes I get output (to the command window) that was probably generated by a line of code that was lacking the semicolon to suppress output. And since the output is just:
ans
   
   = 53

it is hard to debug.

I've check many times but cannot find this line of code. Is there anyway to automatically add a semicolon to every line of code in my folder? Is it possible it is coming from a system routine?

Not a major problem but a nuisance nonetheless.

Subject: supressing output; how to find where it occurs?

From: Steven_Lord

Date: 14 Aug, 2013 20:53:15

Message: 2 of 3



"Godzilla " <godzilla@tokyo.edu> wrote in message
news:kugiqf$84f$1@newscl01ah.mathworks.com...
> I have code with many scripts and sometimes I get output (to the command
> window) that was probably generated by a line of code that was lacking the
> semicolon to suppress output. And since the output is just:
> ans = 53
>
> it is hard to debug.
>
> I've check many times but cannot find this line of code. Is there anyway
> to automatically add a semicolon to every line of code in my folder? Is
> it possible it is coming from a system routine?

No (and that wouldn't necessarily solve the problem) and possibly but IMO
unlikely, respectively. The way I'd probably solve this is by setting a
breakpoint and stepping through the code. You can use a "divide and conquer"
approach to narrow down the location quickly; set a breakpoint on the middle
line of your code. Depending on whether or not the display occurs before you
hit the breakpoint, set the next breakpoint in the middle of the first or
second half of the code. Repeat until you've narrowed down the location to a
small enough section of code for visual inspection.


One situation where it wouldn't solve the problem is where your code
contained a line like:

22+31, plot(1:10);

The _line_ ends with a semicolon already, but one of the _statements_ on the
line does not.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: supressing output; how to find where it occurs?

From: W. Dale Hall

Date: 20 Jan, 2014 21:14:50

Message: 3 of 3

Godzilla wrote:
> I have code with many scripts and sometimes I get output (to the command
> window) that was probably generated by a line of code that was lacking
> the semicolon to suppress output. And since the output is just:
> ans = 53
>
> it is hard to debug.
>
> I've check many times but cannot find this line of code. Is there
> anyway to automatically add a semicolon to every line of code in my
> folder? Is it possible it is coming from a system routine?
>
> Not a major problem but a nuisance nonetheless.

Try Google with this set of words:

matlab missing semicolon

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us