Syntax
[l,a]=lengthNaN(CPL)
Input Parameter
Output Parameter
l : | | length of the individual segments of the nan separated list |
a : | | starting indices |
Examples
loadweb CAD_pictures.mat; imshow(CADpictservo);
CPLofimage(CADpictservo); CPL=ans;
selectNaN(CPL,find(lengthNan(CPL)>300));
[a,b]=lengthNaN(CPLsample(11))
Copyright 2018-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 process a NaN-separated list, which is a list where segments are separated by NaN (Not-a-Number) values. The function lengthNaN
calculates the length of each segment and provides the starting indices of these segments.
Input Parameters
- CPL: A matrix where each row represents a point, and segments are separated by NaN values in the first column.
Output Results
- l: A vector containing the lengths of the individual segments in the NaN-separated list.
- a: A vector containing the starting indices of each segment.
Algorithm Steps
- Find the indices of NaN values in the first column of
CPL
using find(isnan(CPL(:,1)))
.
- Append the size of
CPL
plus one to the list of NaN indices to handle the end of the list.
- Calculate the lengths of each segment by taking the difference between consecutive NaN indices and store them in
l
.
- Subtract one from each length to account for the NaN separator itself.
- Determine the starting indices of each segment by taking the indices of the first element of each segment and store them in
a
.
Example Usage
In the example provided, a CAD image is loaded, and a NaN-separated list is created from it. The function lengthNaN
is then used to find segments longer than 300 units.
Algorithm explaination created using ChatGPT on 2025-08-18 23:41. (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