find2logical

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 4.9, Creation date: 2020-01-19, Last change: 2025-09-14

converts a index list into a logical vector

Description

exist most probably already in matlab

See Also: rcofind , indofrc

Example Illustration

 missing image of find2logical(ind,N)

Syntax

l=find2logical(ind,N)

Input Parameter

ind: index list
N: numel of logical row vector

Output Parameter

l: logical row vector

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

Output Results

Algorithm Steps

  1. Initialize a logical row vector l of length N with all elements set to false.
  2. 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