Hi all,
I have a matrix with some numbers (0:5). The number sequence usually begins
with 1, but if starts in column 1 it can begin with another number. Once
started it will go sequentially with no 0s in the middle, then go back to 0s. I
want to do the following for each row:
1. If the sum of the row is zero, leave it as all 0s (i.e. it's blank to begin
with, then leave it blank)
2. If the sum of the row is not zero, continue and do the following
3. Fill it with 1s until I hit the first "1", fill it with zeroes thereafter
Here is an example:
Start Matrix
00000000000000000
00001230000000000
00000000100000000
45000000000000000
23400000000000000
12345000000000000
00000012345000000
...
End Matrix
00000000000000000
11111000000000000
11111111100000000
00000000000000000
00000000000000000
10000000000000000
11111110000000000
...
It is a large enough matrix that I get a memory error if I use for loops (about
30x10000). I also need to keep the ordering of the rows, so if I start doing
things like breaking it up in chunks it has to be put back properly.
I appreciate any suggestions.
thanks in advance,
Felipe
---------------------------------------
The information contained in this e-mail message, and any attachment thereto,
is confidential and may not be disclosed without our express permission. If
you are not the intended recipient or an employee or agent responsible for
delivering this message to the intended recipient, you are hereby notified that
you have received this message in error and that any review, dissemination,
distribution or copying of this message, or any attachment thereto, in whole or
in part, is strictly prohibited. If you have received this message in error,
please immediately notify us by telephone, fax or e-mail and delete the message
and all of its attachments. Thank you.
Every effort is made to keep our network free from viruses. You should,
however, review this e-mail message, as well as any attachment thereto, for
viruses. We take no responsibility and have no liability for any computer
virus which may be transferred via this e-mail message.
|