Borrar filtros
Borrar filtros

Find subvector/submatrix within matrix (with place holder)

3 visualizaciones (últimos 30 días)
Andreas
Andreas el 7 de Jul. de 2017
Respondida: Image Analyst el 7 de Jul. de 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

Respuestas (1)

Image Analyst
Image Analyst el 7 de Jul. de 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.

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by