Re: Unpacking algoritmn [message #39461 is a reply to message #39326] |
Mon, 17 May 2004 07:40  |
James Kuyper
Messages: 425 Registered: March 2000
|
Senior Member |
|
|
Tmorri wrote:
> Thanks for your replay. I made a little mistake in the statement of the
> problem, what I really need is this:
>
> x1,x2,x3,x4,x5 are variables that can take any value, even zero, (0).
>
> I just want to get rid othe zeroes shown in vector v0
>
> v0=[0 x1 x2 x3 0 x4 x5 x1 0 x2 x3 x4 0 x5 x1 x2 0 x3 x4 x5]
>
> in the following way:
>
> v1=[0 0 0 0 0]
>
> v2=[x1 x2 x3 x4 x5 x1 x2 x3 x4 x5 x1 x2 x3 x4 x5]
Examples can be useful for illustrating a problem definition, but
they're a poor method for actually defining the problem, as you've
already seen.
The key issue here, is how should the code you're looking for identify
which values to put into v1, and which ones to put into v2? David
Fanning's answer was based upon one assumption, which was compatible
with your first example: that the items to go into v0 are the ones with
a value of 0. Now we know that it's what you want, we have to make a
different guess.
My best guess is that you want to put into v1 every fourth element,
starting with element 0. You want the rest of the elements in v2. Is
that correct? Will the total number of elements always be a multiple of
4, or will there sometimes be a few left over? Will the total number of
elements always be exactly 20?
|
|
|