CLsortrows

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CPL/Closed Polygon Lists
Introduced first in SolidGeometry 5.1, Creation date: 2021-04-29, Last change: 2025-09-15

Sorts a corrleation list

Description

Use ELunsort to check

See Also: CLofFLW , PLcorrelationcheck , CLplot

Example Illustration

 missing image of CLsortrows(CL)

Syntax

CL=CLsortrows(CL)

Input Parameter

CL: Correlation list

Output Parameter

CL: Sorted Correlation list

Examples


[SG,FLW]=SGofCPLz(PLcircle(10,10),20); CL=CLofFLW(FLW), [PLA,PLNB]=PLofCL(CL);
CLN=ELunsort(CL), CLsortrows(CL)




Copyright 2021-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

Algorithm (Workflow)

This function, CLsortrows, is designed to sort a correlation list (CL) and is part of the SolidGeometry library. Below is a detailed explanation of the algorithm and its parameters:

Input Parameters

Output

Algorithm Steps

  1. The function begins by sorting the rows of the input correlation list CL using the sortrows function. This function sorts the rows of a matrix based on the values in the columns, starting with the first column.
  2. It then identifies the indices of rows where the first column has the value 1 using find(CL(:,1)==1) and stores these indices in i1.
  3. Similarly, it finds the indices of rows where the first column has the value 2 using find(CL(:,1)==2) and stores these indices in i2.
  4. The algorithm checks if the second column value of the last row in i1 is greater than the second column value of the first row in i2. If this condition is true, it swaps the second column values of the first and last rows in i1 using the flipvar function.
  5. If there are no output arguments (nargout==0), the function calls PLcorrelationcheck(CL) to perform a correlation check and CLplot(CL) to plot the correlation list.

Additional Notes

The function is part of a library for handling closed polygon lists and is used in conjunction with other functions like CLofFLW, PLcorrelationcheck, and CLplot.

Algorithm explaination created using ChatGPT on 2025-08-18 23:13. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21