comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: A little help
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: A little help [message #80052] Thu, 10 May 2012 05:34 Go to next message
greg.addr is currently offline  greg.addr
Messages: 160
Registered: May 2007
Senior Member
nata's solution doesn't work...

IDL> print,b
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 5 5 7 7
3 3 3 3 3 3 3 3
6 6 8 8 3 3 3 3
6 6 8 8 3 3 3 3

I suppose one of the rules must be that number blocks are 'rigid'. But that's still not enough... the 7- and 8-blocks could equally move upwards between the 1- & 2-blocks, giving a result that's not square. So then you need a condition that the final result is square, which seems like a game to me. Nice puzzle, though!
Re: A little help [message #80053 is a reply to message #80052] Thu, 10 May 2012 05:10 Go to previous messageGo to next message
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
Sorry, you have to use REFORM instead of REBIN !
Re: A little help [message #80055 is a reply to message #80053] Thu, 10 May 2012 05:05 Go to previous messageGo to next message
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
mask=WHERE(A NE 0,nm)
IF nm GT 0 THEN B=REBIN(A[mask],8,8)

I don't know if this is going to work, but you can try.
As Yngvar said, you need to specify the rules. If in the resulting array there are more than 8x8 values, the code won't work.

Bernat

On Thursday, May 10, 2012 7:45:20 AM UTC-4, Konstantinos wrote:
> On 10 Μάϊος, 14:09, Yngvar Larsen <larsen.yng...@gmail.com> wrote:
>> On Thursday, 10 May 2012 11:00:49 UTC+2, Konstantinos  wrote:
>>> 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
>>
>> This looks like some kind of game. You need to specify the rules in order to solve this in general.
>>
>> PS: I assume one "3" too much in your A matrix, and four of the "5"s in B should really be "6"?
>>
>> --
>> Yngvar
>
> Dear Yngvar.
>
> No this is not a game,..imagine it as a matrix. Numbers 1,2,3, 5, 6,
> 8 are just numbers different than zero. I just put 1,2,3... for
> better viewing my image
Re: A little help [message #80056 is a reply to message #80055] Thu, 10 May 2012 04:59 Go to previous messageGo to next message
Vincent Sarago is currently offline  Vincent Sarago
Messages: 34
Registered: September 2011
Member
I assume you want to "compress" an image for suppressing all "0" Values

but what will you do if you have :

0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 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

?

On Thursday, May 10, 2012 1:45:20 PM UTC+2, Konstantinos wrote:
> On 10 Μάϊος, 14:09, Yngvar Larsen <larsen.yng...@gmail.com> wrote:
>> On Thursday, 10 May 2012 11:00:49 UTC+2, Konstantinos  wrote:
>>> 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
>>
>> This looks like some kind of game. You need to specify the rules in order to solve this in general.
>>
>> PS: I assume one "3" too much in your A matrix, and four of the "5"s in B should really be "6"?
>>
>> --
>> Yngvar
>
> Dear Yngvar.
>
> No this is not a game,..imagine it as a matrix. Numbers 1,2,3, 5, 6,
> 8 are just numbers different than zero. I just put 1,2,3... for
> better viewing my image
Re: A little help [message #80057 is a reply to message #80056] Thu, 10 May 2012 04:45 Go to previous messageGo to next message
Konstantinos is currently offline  Konstantinos
Messages: 29
Registered: April 2011
Junior Member
On 10 Μάϊος, 14:09, Yngvar Larsen <larsen.yng...@gmail.com> wrote:
> On Thursday, 10 May 2012 11:00:49 UTC+2, Konstantinos  wrote:
>> 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
>
> This looks like some kind of game. You need to specify the rules in order to solve this in general.
>
> PS: I assume one "3" too much in your A matrix, and four of the "5"s in B should really be "6"?
>
> --
> Yngvar

Dear Yngvar.

No this is not a game,..imagine it as a matrix. Numbers 1,2,3, 5, 6,
8 are just numbers different than zero. I just put 1,2,3... for
better viewing my image
Re: A little help [message #80058 is a reply to message #80057] Thu, 10 May 2012 04:09 Go to previous messageGo to next message
Yngvar Larsen is currently offline  Yngvar Larsen
Messages: 134
Registered: January 2010
Senior Member
On Thursday, 10 May 2012 11:00:49 UTC+2, Konstantinos wrote:
> 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

This looks like some kind of game. You need to specify the rules in order to solve this in general.

PS: I assume one "3" too much in your A matrix, and four of the "5"s in B should really be "6"?

--
Yngvar
Re: A little help [message #80200 is a reply to message #80052] Thu, 10 May 2012 06:08 Go to previous message
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
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
Re: A little help [message #84670 is a reply to message #80053] Thu, 10 May 2012 05:22 Go to previous message
Vincent Sarago is currently offline  Vincent Sarago
Messages: 34
Registered: September 2011
Member
Nata is wright, but if you don't know the result size (8x8) you can try that :

a = intarr(10,10) + 1
a[*,4] = 0
a[4,*] = 0

print, a
print

nRow = (size(a))[2]

b = list()

for ii = 0, nRow - 1 do begin
test = where(a[*,ii] ne 0, count)
if count ne 0 then b.add, a[test,ii]
endfor

print, b
print

c = b.ToArray(TYPE=5, MISSING = !VALUES.D_NAN)

help, c
print, c

END








On Thursday, May 10, 2012 2:10:47 PM UTC+2, nata wrote:
> Sorry, you have to use REFORM instead of REBIN !
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: A little help....
Next Topic: Widget to play and pause image stack display

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:49:11 PDT 2025

Total time taken to generate the page: 0.00597 seconds