unsortNaN

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

change the order the entries of a NaN separted list

Description

mainly for testing other NaN functions

See Also: selectNaN , lengthNaN , replaceNaN , cellofNaN , separateNaN , uniqueNaN , unsortrows

Example Illustration

 missing image of unsortNaN(CPL)

Syntax

CPLU=unsortNaN(CPL)

Input Parameter

CPL: Original nan separated list

Output Parameter

CPLU: Unsorted nan separated list

Examples


CPLsample(13); CPL=ans;
hideingca('text'); unsortNaN(CPL); CPL=ans; textCVL(ans); shg




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

Algorithm (Workflow)

This algorithm is designed to unsort a NaN-separated list, primarily for testing other NaN functions. It is part of the SolidGeometry library.

Input Parameters

Output Results

Algorithm Steps

  1. Call the function separateNaN(CPL) to determine the number of NaN-separated segments in the list CPL. This returns the number of segments n.
  2. Use ELofn(n) to get an array of indices or elements related to the segments.
  3. Pass the result to ELunsort() to shuffle or unsort these indices or elements, storing the result in EL.
  4. Extract the first column of EL into ai, which contains the order in which segments will be selected.
  5. Determine the number of columns in CPL using size(CPL,2) and store it in rc.
  6. Initialize an empty array CPLU to store the unsorted list.
  7. Iterate over each segment index i from 1 to n:
  8. Remove the last row of NaNs from CPLU using CPLU=CPLU(1:end-1,:) to ensure the list ends correctly.

The function effectively shuffles the order of segments in a NaN-separated list, maintaining the structure but altering the sequence.

Algorithm explaination created using ChatGPT on 2025-08-18 23:37. (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