Problem 2592. LocateMembership | Membership of Matrix in another matrix
Let a and b be given by
a = [ 2 1 1 1 1 2 1 1 1 1 2 1 1 1 1 2 4 0 0 0 ]
b = [ 2 1 1 1 2 1 1 1 2 ]
then b can be created using a (b is wholly present in a). So output should be location of central element of b in a.
Here output is [3,3] else it should be [0,0].
Solution Stats
Problem Comments
-
5 Comments
in test case 3, b is not available in a. I might be wrong.. Please Check
Not logic to ask a scalar (if no location), an array (if 1), and a cell (if 2). And why not add the example (difficult) in the tests ?
@rifat : updated, thanks for info
Nice problem. Some solutions (using conv, filter2 etc.) doesn't check conditions properly. Adding a=2*ones(4); b=3*eye(3)+1; or a=0; b=0; or similar can improve the testsuite;
The solution in the example is [2 2;3 3].
Solution Comments
Show commentsProblem Recent Solvers22
Suggested Problems
-
Select every other element of a vector
32986 Solvers
-
Equidistant numbers containing certain value in an interval
87 Solvers
-
Project Euler: Problem 1, Multiples of 3 and 5
3169 Solvers
-
Project Euler: Problem 6, Natural numbers, squares and sums.
2139 Solvers
-
Count decimal digits of a number
226 Solvers
More from this Author6
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!