numofstrtab

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Text/Strs/Chars/Links
Introduced first in SolidGeometry 3.8, Creation date: 2017-04-09, Last change: 2025-09-14

returns a row number of a cell list of strings



See Also: SGmodelOR , getvarg

Example Illustration

 missing image of numofstrtab(tok,strtab)

Syntax

nr=numofstrtab(tok,strtab)

Input Parameter

tok: string to compare with;
strtab: cell list; frist col = string

Output Parameter

nr: cell list row, col 2: end

Examples


strtab={'spine',1; 'torso',2; 'carm', 3;'table',4};
numofstrtab ('TORSO',strtab);




Copyright 2017-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, numofstrtab, is designed to find a specific row in a cell array of strings based on a given token. It returns the contents of the second column of the matched row.

Input Parameters

Output Results

Algorithm Steps

  1. Initialize nr as an empty array.
  2. Iterate over each row of strtab using a for-loop.
  3. For each row, compare the first column string with the lowercase version of tok using isequal.
  4. If a match is found, set nr to the contents of the second column of that row and exit the loop.
  5. After the loop, if nr is still empty and tok is numeric, set nr to tok.

Example

Given the cell array strtab={'spine',1; 'torso',2; 'carm', 3;'table',4} and the token 'TORSO', the function will return 2 as it matches the second row.

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