Filter löschen
Filter löschen

Find subvector/submatrix within matrix (with place holder)

3 Ansichten (letzte 30 Tage)
Andreas
Andreas am 7 Jul. 2017
Beantwortet: Image Analyst am 7 Jul. 2017
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

Antworten (1)

Image Analyst
Image Analyst am 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.

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by