VLremsuccident
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 3.8, Creation date: 2017-04-06, Last change: 2025-09-14
Removes successive identical lines in a list AND opens a PL.
Description
Fnctn is able to handle doubled nan too! It was designed for open PL ways returns a PL/VL since last and frist point are succeeding points and the first remains.
See Also: CVLremstraight
Example Illustration
Syntax
[SVL,ii]=VLremsuccident(VL)
Input Parameter
Output Parameter
SVL: | | decimated list |
ii: | | removed indices in original list |
Examples
CPL=rounddiv(CPLaddauxpoints(CPLoftext('test'),1),1)
VLremsuccident(CPL)
Copyright 2017-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, VLremsuccident, is designed to remove consecutive identical rows from a list of numeric rows, including handling cases where the rows contain NaN values. It is part of the SolidGeometry library and was introduced in version 3.8.
Input Parameters
- VL: A list of numeric rows. This is the input list from which consecutive identical rows will be removed.
Output Results
- SVL: The decimated list, which is the input list with consecutive identical rows removed.
- ii: Indices of the removed rows in the original list.
Algorithm Steps
- Initialize an index vector
ii with zeros, having the same number of rows as VL.
- Create a shifted version of
VL called YL using circshift to shift the rows by -1.
- Iterate over each row of
VL:
- For each row, check if it is equal to the corresponding row in
YL using isequal.
- Additionally, check if both rows contain
NaN values in the first column.
- If either condition is true, set the corresponding index in
ii to 1.
- Create
SVL by selecting rows from VL where ii is false (i.e., rows that are not consecutive duplicates).
- If no output arguments are specified, plot the original and decimated lists using
SGfigure and CVLplot.
Example Usage
An example of using this function is provided, where a list CPL is processed to remove consecutive identical rows:
CPL = rounddiv(CPLaddauxpoints(CPLoftext('test'), 1), 1);
VLremsuccident(CPL);
Algorithm explaination created using ChatGPT on 2025-08-19 00:10. (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