Syntax
[x,a]=separateNaN(VL,i)
Input Parameter
VL : | | List of nan separated sublists |
i : | | optional number of sublist |
Output Parameter
x : | | List i or number of lists if nargin==1 |
a : | | list of [0 nans size(VL,2)+1] |
Examples
how to use
nf=separateNaN(FL); if nf>1; for i=1:nf; PL=separateNaN(FL,i); end;
Example:
VL=[rand(4,3);NaN NaN NaN;rand(2,3)]
[nf,l]=separateNaN(VL)
separateNaN(VL,2)
Copyright 2015-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, separateNaN
, is designed to handle lists of data that are separated by rows of NaN (Not-a-Number) values. It is part of the SolidGeometry library and was introduced in version 2.4. The function can either return the number of sublists separated by NaN rows or extract a specific sublist based on an optional index parameter.
Input Parameters
- VL: A matrix where sublists are separated by rows of NaN values.
- i: An optional parameter specifying the index of the sublist to be extracted.
Output Results
- x: If only
VL
is provided, x
is the number of sublists. If both VL
and i
are provided, x
is the sublist at index i
.
- a: A list indicating the positions of NaN rows and the size of
VL
plus one.
Algorithm Steps
- Check if
VL
is empty. If it is, set x
to 0 and a
to an empty array, then return.
- Determine the number of rows in
VL
and find the indices of NaN rows. Append the size of VL
plus one to the list of indices.
- If only
VL
is provided, check the length of the list of indices. If it is 2, set x
to 1; otherwise, set x
to the number of sublists (length of indices minus one), then return.
- If
i
is provided, filter out invalid indices (less than 1 or greater than the number of sublists). If the filtered index list is different from the original, issue a warning.
- Check if the index
i
is valid. If not, set x
to an empty array and return.
- Extract the sublist at the specified index
i
from VL
and assign it to x
.
Algorithm explaination created using ChatGPT on 2025-08-19 01:34. (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