by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 4.7, Creation date: 2019-07-08, Last change: 2025-09-14
See Also: selectNaN
, lengthNaN
, replaceNaN
, cellofNaN
, separateNaN
, unsortNaN
[CPLU,ai]=uniqueNaN(CPL)
CPL: | Original NaN sperated list |
CPLU: | Reduced Nan separted list with unique entries | |
ai: | indes list for |
CPL=[CPLsample(13);nan nan;CPLsample(13)]
[a,b]=uniqueNaN(CPL)
This algorithm is designed to process a list separated by NaN values, identifying unique sublists within it. The function uniqueNaN takes a NaN-separated list as input and returns a reduced list with unique entries, along with an index list.
CPL using the function separateNaN, which counts the segments separated by NaN.ul with the first sublist index and ai with NaN values, setting the first index to 1.CPL starting from the second one:selectNaN and isequal.ai with the index of the matching unique sublist and break the loop.ul and update ai with the new unique index.selectNaN to extract the unique sublists from CPL based on the indices in ul.The function effectively reduces the input list to its unique components, providing a streamlined version of the data for further analysis or processing.
Algorithm explaination created using ChatGPT on 2025-08-18 23:58. (Please note: No guarantee for the correctness of this explanation)