Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Size-function and ";"
Date: Tue, 27 Oct 2009 17:42:19 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 48
Message-ID: <hc7bdr$mtg$1@fred.mathworks.com>
References: <hc6rc3$4ji$1@fred.mathworks.com> <hc6scn$cmv$1@news.eternal-september.org>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1256665339 23472 172.30.248.38 (27 Oct 2009 17:42:19 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 27 Oct 2009 17:42:19 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2049697
Xref: news.mathworks.com comp.soft-sys.matlab:580415


Okay, here is the entire code up until the problem:

% DESCRIPTION ---------------------------------------------------
% 2D heat flow applying plane triangular elements of the lpt type
% with linear field approximation.

close all, clear all

% Independent parameters
a=8e-3;
b=12*a;
nelb=4;
El=b/2*nelb;
% lx=2.0;                     % length of the domain
% ly=1.0;                     % width of the domain

% TOPOLOGY ------------------------------------------------------
% node coord's

for i=1:2*nelb+1
    sys.X(i,:)=[(i-1)*El 0.0];
end

for i=1:2*nelb+1
    sys.X=[sys.X ; [(i-1)*El 0.5]];
end

for i=1:2*nelb+1
    sys.X=[sys.X ; [(i-1)*El 1]];
end

%el topo
nno=size(sys.X,1);
counter=0;
for i=1:2:2*nelb
    counter=counter+1;
    sys.T{counter}=[i i+2 nno-2*nelb+(i-1)];      
end
for i=1:2:2*nelb   %This entire loop seems to be disregarded by the following size-func.
    counter=counter+1;
    sys.T{counter}=[i+2 nno-2*nelb+(i+1) nno-2*nelb+(i-1)]  % ";"-problem!
end

size(sys.T,2)
----------------------------------------

If ";" is omitted from 4th line from the bottom size(sys.T,2) works as expected, and returns 8.
If ";" is included size(sys.T,2)  returns only 4. This corresponds to the last loop being omitted. When, however I type size(sys.T,2) in the command window after the code has been executed, it returns the proper result, 8.