On 2/8/2012 3:02 PM, camilla belle wrote:
> For unique numbers it will work but for repeated it will show every number
> from B that equals one from A.
...
That's true...
You didn't specify the application.
But, the above was shown to demonstrate one starting point containing
the necessary information--add the logic to the above to test that there
is an area of the size of the smaller within the area that is all TRUE,
essentially by deleting contiguous rows in which all elements are 0 and
see if can end up w/ a sub-array the size of the target which satisfies
all(subarray)==TRUE
The more a priori knowledge you have regarding the location of such a
subarray within the larger, the more you can streamline the process--if,
for example, you knew there can't be row in the middle of the subarray
if it exists that is not part of that array, then you can use any() and
all() w/ the dimension arguments and set the found rows/columns = [] w/o
additional checking, just using the found indices. If, otoh, you could
have a row (say) that is all false in the middle of a pattern and that
eliminating that row would create a false subarray, then you would need
to only eliminate rows/columns that are not inside a potential area,
much like Roger's solution.
--