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.


In reply to Re^2: filling in the zeros...please help by david_lyon
in thread filling in the zeros...please help by david_lyon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.