ELofmatrixneigbors

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - VM/Voxels
Introduced first in SolidGeometry 4.8, Creation date: 2019-12-10, Last change: 2025-09-14

creates a complete edge list for a edgelist 4x4 neighborhood of a matrix

Description

This function creates edge lists related to the single index use of a matrix:
N=reshape(M,'',1) or simply use M(i)
Use matrixneighbors for single entries

See Also: GPLofmatrix , matrixdistanceofCPL , matrixneighbors , ELofmatrixneigborweight , matrixlocalminmax

Example Illustration

 missing image of ELofmatrixneigbors(rc)

Syntax

[EL4,EL8]=ELofmatrixneigbors(rc)

Input Parameter

rc: 2D Matrix or [rows cols]

Output Parameter

EL4: straight neighbor edge list related to reshape(M,'',1)
EL8: diagonal neighbor edge list related to reshape(M,'',1)

Examples


r=4;c=5; M=reshape(1:r*c,r,[])
ELofmatrixneigbors(M)
ELofmatrixneigbors(size(M))
EL=sortrows(ELofmatrixneigbors(M)); EL(1:15,:)
[M,GPL,~,ax]=matrixdistanceofCPL(CPLsample(3),30); whos M, whos GPL, SGfigure; matrixplot(M,'',ax);
EL=ELofmatrixneigbors(M); whos EL
SGfigure; VLELplots(GPL,EL,'g-'); CPSplot(CPLsample(3));




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