필터 지우기
필터 지우기

Find subvector/submatrix within matrix (with place holder)

조회 수: 3 (최근 30일)
Andreas
Andreas 2017년 7월 7일
답변: Image Analyst 2017년 7월 7일
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

답변 (1개)

Image Analyst
Image Analyst 2017년 7월 7일
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.

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by