matrixneighbors
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 4.8, Creation date: 2019-11-24, Last change: 2025-09-14
returns the coordinates for matrix neigbors
Description
There are many different methods to implement search algorithms on matrices. This set of functions
matrixvalues
matrixneighbors
support simple local implementation methods
See Also: GPLofmatrix
, matrixvalues
, matrixdistancefield
Example Illustration
Syntax
RCN=matrixneighbors(Ms,RCL,[masktyp,noncirc])
Input Parameter
Ms: | | size(Matrix) |
RCL: | | [row col] coordinate |
masktyp: | | '4' or '8' as mask type |
noncirc: | | noncircular or circular neighborhood; default is true |
Output Parameter
RCN: | | row cols neighbors; nan for non existing |
Examples
m=5; M=circshift(reshape(1:m*m,m,[]),[floor(randminv(m)),floor(randminv(m))])
mn=matrixneighbors(size(M),[1 1])
matrixvalues(M,mn)
Copyright 2019-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Last html export of this page out of FM database by TL: 2025-09-21