Path: news.mathworks.com!newsfeed-00.mathworks.com!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.straub-nv.de!feeder.eternal-september.org!eternal-september.org!not-for-mail
From: dpb <none@non.net>
Newsgroups: comp.soft-sys.matlab
Subject: Re: matrix generation
Date: Sun, 08 Nov 2009 11:25:14 -0600
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <hd6utr$jgr$2@news.eternal-september.org>
References: <hd6uef$j43$1@fred.mathworks.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.eternal-september.org U2FsdGVkX1+1+8z7V0yxhL7JGBGPsl2AVsFhn3eCqegCHYpU7YvW9mAedbfajtTpdHAtujkyDaZK+rLlAUxXMVRLd96iW4fCaaPbHsPQHWS0JppkVFmaJdj5aHZ3dho0ZZ3BEiDMT+c79x+GuIU8dw==
X-Complaints-To: abuse@eternal-september.org
NNTP-Posting-Date: Sun, 8 Nov 2009 17:25:16 +0000 (UTC)
In-Reply-To: <hd6uef$j43$1@fred.mathworks.com>
X-Auth-Sender: U2FsdGVkX19muWU5HlB4lhzKrIabRFQDZHSVKQFdwnI=
Cancel-Lock: sha1:BZkb07k1JQMF+Kk17XfrtF+kxOw=
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
Xref: news.mathworks.com comp.soft-sys.matlab:583373


jack j wrote:
> 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?

Generate (say) first and second columns then add 2 and 3, respectively. 
    You can ensure the condition by either rejecting greater>50 values 
and regenerating that pair or restrict the original rng range to <48 so 
sum can exceed 50.

--