Path: news.mathworks.com!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!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 12:10:24 -0600
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <hd71ii$9sb$1@news.eternal-september.org>
References: <hd6uef$j43$1@fred.mathworks.com> <hd6vnm$7u3$1@fred.mathworks.com> <hd70t6$iun$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/jCSxutaXpHkygMXQ5dCwX7BHSZDeXP1plryFln18FJhZxI+QXSgk/yZDkeJYq2qM+FNvye1gFU18A9HlkNAJZ1UQRlRGahGiBgugUvZ5ePgVM0jAg18Nqg724ybbEkFHORZAQNv30pQ==
X-Complaints-To: abuse@eternal-september.org
NNTP-Posting-Date: Sun, 8 Nov 2009 18:10:27 +0000 (UTC)
In-Reply-To: <hd70t6$iun$1@fred.mathworks.com>
X-Auth-Sender: U2FsdGVkX18b1NUNH6/07XimwMgogeoXhQ/a0Ew1Jr4=
Cancel-Lock: sha1:FK0EkyJH0DvmXs0jR1AuRWufsyw=
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
Xref: news.mathworks.com comp.soft-sys.matlab:583381


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

Yes, precisely what I suggested altho he chose 1 and 4 as the two 
independent and did a little finer pruning on the upper bounds than a 
single limit.

--