Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Size-function and ";"
Date: Tue, 27 Oct 2009 13:08:20 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 18
Message-ID: <hc6rc3$4ji$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1256648900 4722 172.30.248.35 (27 Oct 2009 13:08:20 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 27 Oct 2009 13:08:20 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2049697
Xref: news.mathworks.com comp.soft-sys.matlab:580339


I have this very annoying problem, that I have now encoutered a few times:

Excerpt of the code:
------
...
for i=1:nelb
    sys.T{i+nelb}= [i+1 i+nelb+1 i+nelb+2]  % ";" gives error?!
end

size(sys.T,2)
------
(some other stuff is before this, but this is what seems to be causing the problems.)

If the operation in the for-loop is ended with a ";" then "size(sys.T,2)" returns a value, as if the loop has not been run at all. If ";" is omitted it returns fine, but I of course have a very cluttered command window.

If I run the program with the ";" and then after the program has finished type "size(sys.T,2)" in the command window, it returns the proper result.

What is happening and how do I fix it?