Path: news.mathworks.com!not-for-mail
From: "Ondrej " <ondrej.muransky@ansto.gov.au>
Newsgroups: comp.soft-sys.matlab
Subject: create matrix/array
Date: Mon, 23 Mar 2009 22:39:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 23
Message-ID: <gq9325$2iv$1@fred.mathworks.com>
Reply-To: "Ondrej " <ondrej.muransky@ansto.gov.au>
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 1237847941 2655 172.30.248.35 (23 Mar 2009 22:39:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 23 Mar 2009 22:39:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1699113
Xref: news.mathworks.com comp.soft-sys.matlab:527108

Hi Guys,

I would need a help with creating a matrix/array which is going to have 18 columns and 76 rows,&#8230; first 4 rows are &#8220;0&#8221;, next 4 rows are &#8220;5&#8221;, next 4 rows are &#8220;10&#8221; and so on the last 4 rows are &#8220;90&#8221;,&#8230;. for this I wrote the following script:

row1 = 1:4:76;
row2 = 0:5:90;
 
 for ii =1:1:size(row1,2);
   for jj = 1:1:size(row2,2);
          
b(row1(ii),:)= (row2(jj))*ones(1,18);
b((row1(ii)+1),:)= (row2(jj))*ones(1,18);
b((row1(ii)+2),:)= (row2(jj))*ones(1,18);
b((row1(ii)+3),:)= (row2(jj))*ones(1,18);
 
    end
end


but it gives &#8220;90&#8221; in all 76x18 cells for reason I don&#8217;t see,&#8230; there must be some problem with jj loop?

Many thanks for the help
Ondrej