Path: news.mathworks.com!newsfeed-00.mathworks.com!solaris.cc.vt.edu!news.vt.edu!news.glorb.com!feeder.erje.net!news.albasani.net!.POSTED!not-for-mail
From: Lothar Schmidt <vapooroop@gmx.net>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Creating array with specific sum
Date: Fri, 22 Jul 2011 13:07:59 +0200
Organization: albasani.net
Lines: 12
Message-ID: <j0blml$d45$1@news.albasani.net>
References: <j0bgc5$g05$1@newscl01ah.mathworks.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.albasani.net mZPpuRq7gTnxCW6rvWf90gascmeJuxNrLjvhDyXf5uHbtKGAR8HewotszYNi6kcA9lztbSv2LjXhRJ5H0lgyvJ8elKf91oqDHUeCeIvSWObgveQ47yk3/O9wjzx+UD3W
NNTP-Posting-Date: Fri, 22 Jul 2011 11:08:05 +0000 (UTC)
Injection-Info: news.albasani.net; logging-data="TZ3ZlfmkvaatnqqJdP2Z+ORnUQuVIFc1S2glNG/FMZxVJzqyeFJRG3WEil6GvA9FW0m75fzvBMgcC0gYp8IdI/Jwea60T5thK2ZufWGhid7A2NUYrtxXjcinakyBX65T"; mail-complaints-to="abuse@albasani.net"
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20110624 Thunderbird/5.0
In-Reply-To: <j0bgc5$g05$1@newscl01ah.mathworks.com>
Cancel-Lock: sha1:C1DR1l0akIZ42i6LvaDZsqJElaU=
Xref: news.mathworks.com comp.soft-sys.matlab:737153

Am 22.07.2011 11:37, schrieb Mohd:
> Hi,
>
> I want to create a 1xn array, that come out with specific total. For
> example, given the summation of array is 20. Then, I want to create an
> array with 1x5 matrix. The answer might be as follow:
> [5 7 3 2 3], or [2 4 1 7 6] or any other 1x5 matrix with total 20.
>
> Thank you.

do you expect a special kind of distribution?
are negativ values allowed?