Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: matrix generation
Date: Sun, 8 Nov 2009 17:59:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 21
Message-ID: <hd70t6$iun$1@fred.mathworks.com>
References: <hd6uef$j43$1@fred.mathworks.com> <hd6vnm$7u3$1@fred.mathworks.com>
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 1257703142 19415 172.30.248.38 (8 Nov 2009 17:59:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 8 Nov 2009 17:59:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2017533
Xref: news.mathworks.com comp.soft-sys.matlab:583379


"Miroslav Balda" <miroslav.nospam@balda.cz> wrote in message <hd6vnm$7u3$1@fred.mathworks.com>...
> "jack j" <12mailjack@gmail.com> wrote in message <hd6uef$j43$1@fred.mathworks.com>...
> > Hi,
> > I want to generate a 6x4 matrix of positive integers(max value:50) such that the difference between the 3rd element and 1st element in each row is 2 and difference of 2nd and 4th row element in all rows is 3.     
> > Any help?
> 
> Hi,
> 
> Does it fit you?
> 
> %   jack.m      2009-11-08
> %%%%%%%%%%%%
> A = zeros(6,4);
> A(:,1) = ceil(48*rand(6,1));
> A(:,3) = A(:,1)+2;
> A(:,4) = ceil(47*rand(6,1)+3);
> A(:,2) = A(:,4)-3
> 
> Mira

Thankx Mira, it works....and thanks dpb......