I have a 1024 by 1024 by 150 array consisting of ones and zeros. How do i delete all the rows and columns containing all zeros and no ones, excluding the ones between ones. Example:
0 0 0 0 0
0 1 1 0 1
0 1 1 0 0
0 0 0 0 0
0 1 0 0 0
would result in :
1 1 0 1
1 1 0 0
0 0 0 0 this row would not get deleted because it is between rows containing ones
1 0 0 0
Looking at the original one:
row 1 got deleted because it contained all zeros and was not sandwiched between rows of ones
row 4 would not get deleted because it is sandwiched between rows containing ones
column 1 got deleted because it contained all zeros and was not sandwiched between columns of ones
column 4 would not get deleted because it is sandwiched between rows containing ones
Can you please answer the question with regards to the 1024 by 1024 by 150 array not a simple 2D array. Thanks
Best Answer