Syntax
l=find2logical(ind,N)
Input Parameter
ind : | | index list |
N : | | numel of logical row vector |
Output Parameter
Examples
find2logical([1 3 5],6)
find2logical([1 3 5]',6)
Copyright 2020-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, find2logical
, is designed to convert an index list into a logical vector. It is part of the SolidGeometry library and was introduced in version 4.9. The function is authored by Tim C. Lueth and is categorized under auxiliary procedures.
Input Parameters
- ind: This is the index list, which contains the positions that need to be set to true in the logical vector.
- N: This represents the number of elements in the logical row vector. It defines the length of the output logical vector.
Output Results
- l: The output is a logical row vector of length
N
. The positions specified in ind
are set to true, while all other positions are false.
Algorithm Steps
- Initialize a logical row vector
l
of length N
with all elements set to false.
- Set the elements of
l
at the indices specified in ind
to true.
Example Usage
To convert the index list [1 3 5]
into a logical vector of length 6, the function call would be:
find2logical([1 3 5], 6)
This would result in the logical vector: [true false true false true false]
.
Similarly, using a column vector for ind
like [1 3 5]'
would yield the same result.
Algorithm explaination created using ChatGPT on 2025-08-18 22:19. (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