Find subvector/submatrix within matrix (with place holder)
2 views (last 30 days)
Show older comments
Hello,
I want to find specific patterns, which are not connected in a matrix.
For example.
The complete vector is a = [1 2 3 4 5 6 8 10]
and now I want to find b = [1 2 X 4], X should be some place holder, I don't care about the value there.
This would be the 1d case, but I'm also interested in the 2d case.
Does anyone have a good idea for the implementation or already code fragments?
Thanks
0 Comments
Answers (1)
Image Analyst
on 7 Jul 2017
The wildcard makes it tricky. Probably strfind() or regexp(). It will be very cryptic, but someone (Andrei, etc.) will know how.
Or you can use a brute force, but easy-to-understand way of scanning element by element looking for a match. In 2-D you can use nlfilter(), in the Image Processing Toolbox, to help.
0 Comments
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!