Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: filling in the zeros...please help

by david_lyon (Sexton)
on May 15, 2012 at 15:12 UTC ( [id://970660]=note: print w/replies, xml ) Need Help??


in reply to Re: filling in the zeros...please help
in thread filling in the zeros...please help


HI

 Kenosis thanks for your help, so from the above data file input example, then column 3 we have:

1,1,1,1,0,0,0,1,1
which the 3 zeros can get transformed to 1,1,1 because its surrounded by the same number '1' ie:
1,1,1,1,1,1,1,1,1

in the next column we have
2,2,0,0,2,2,0,1,2
only the 2 zeros in between the 2' can be changed since its surrounded by the same number '2' ie:
2,2,2,2,2,2,0,1,2
The zero at the 7th element cant be changed to zero since its surrounded by not the same number '2' and '1'


The file has dozens of columns and hundreds of rows and I have to apply this rule  as I walk down each column.

The rule is to fill in zero block in each column only where the numbers before the start and after the end of the zero blocks are the same.


Thanks again for everyones help and would appreciate any code.

  • Comment on Re^2: filling in the zeros...please help

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://970660]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-24 07:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found