Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: matrix generation
Date: Sun, 8 Nov 2009 18:37:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 32
Message-ID: <hd734d$4qi$1@fred.mathworks.com>
References: <hd6uef$j43$1@fred.mathworks.com> <hd6vnm$7u3$1@fred.mathworks.com> <hd70t6$iun$1@fred.mathworks.com> <hd71ii$9sb$1@news.eternal-september.org>
Reply-To: <HIDDEN>
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 1257705421 4946 172.30.248.35 (8 Nov 2009 18:37:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 8 Nov 2009 18:37:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2017533
Xref: news.mathworks.com comp.soft-sys.matlab:583383


dpb <none@non.net> wrote in message <hd71ii$9sb$1@news.eternal-september.org>...
> 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.
> 
> --

But what if the condition is something like " (1st column element-2nd column element)+(3rd column element-4th column element)"for all rows should be equal to x???

In this case will such a defn work out?