A little help [message #80060] |
Thu, 10 May 2012 02:00  |
Konstantinos
Messages: 29 Registered: April 2011
|
Junior Member |
|
|
Dear All,
Lets supose that i have the folowing matrix lets call it A (14
columns
16 rows) with elements as follows
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 0 0 0 0 0 0 0 0 2 2 2 2
1 1 1 1 0 0 0 0 0 0 0 0 2 2 2 2
1 1 1 1 0 0 0 0 0 0 0 0 2 2 2 2
1 1 1 1 0 0 0 0 0 0 0 0 2 2 2 2
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5 5 0 0 7 7 0 0 0 0 0 0 0 0 0 0
5 5 0 0 7 7 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 3 3 3 3
0 0 0 0 0 0 0 0 0 0 0 0 3 3 3 3
6 6 0 0 8 8 0 0 0 0 0 0 3 3 3 3
6 6 0 0 8 8 0 0 0 0 0 3 3 3 3 3
What i want to do is to make a matrix B (8 columns 8 rows) such as
1 1 1 1 2 2 2 2
1 1 1 1 2 2 2 2
1 1 1 1 2 2 2 2
1 1 1 1 2 2 2 2
5 5 7 7 3 3 3 3
5 5 7 7 3 3 3 3
5 5 8 8 3 3 3 3
5 5 8 8 3 3 3 3
I cant think of anything
I ll appreciate any help
Thank u in advance
Kostas
|
|
|
Re: A little help [message #80188 is a reply to message #80060] |
Thu, 10 May 2012 14:46  |
Konstantinos
Messages: 29 Registered: April 2011
|
Junior Member |
|
|
No i am afraid that is not allowed
I dont to solve something special. Just i have such arrays and i want
to "compress" it the way i just explain
Thank U
|
|
|
Re: A little help [message #80195 is a reply to message #80060] |
Thu, 10 May 2012 07:27  |
greg.addr
Messages: 160 Registered: May 2007
|
Senior Member |
|
|
> An believe me this is not a puzzle , not a game
Nothing wrong with games... so can you explain what is is you're trying to solve?
My problem is that this also seems to be a solution:
1111772222
1111772222
1111882222
1111882222
553333
553333
663333
663333
Is that allowed? If not, what's the rule that prevents it?
|
|
|
|
Re: A little help [message #80199 is a reply to message #80060] |
Thu, 10 May 2012 06:48  |
greg.addr
Messages: 160 Registered: May 2007
|
Senior Member |
|
|
On Thursday, May 10, 2012 3:08:22 PM UTC+2, nata wrote:
> ok ok . let's try this:
>
> B=INTARR(8,8)
> sz=SIZE(A,/DIM)
> count=0
> FOR i=0, sz[1]-1 DO BEGIN
> curr_A=A[*,i]
> ww=WHERE(curr_A NE 0,nn_w)
> IF nn_w NE 0 THEN BEGIN
> B[*,count]=curr_A[ww]
> count++
> ENDIF
> ENDFOR
hmm... that fails on the row where you meet the 5s and 7s - your WHERE would need to find all 8 members for that row. Need to shift up those 3s...
|
|
|