Syntax
TL=DINfindinTab(M,Tab,[takelarg])
Input Parameter
M : | | Scalar to find in Tab |
Tab : | | Table with M as first col; Table name is important |
takelarg : | | if true nearest larger is selected; default is true |
Output Parameter
Examples
DIN433=[ 1.0 1.1 2.5 0.3; 1.2 1.3 3.0 0.3];
DINfindinTab(1.1,DIN433)
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, DINfindinTab
, is designed to search for a specific scalar value within a given table and return the corresponding row. It is part of the SolidGeometry library and was introduced in version 4.9.
Input Parameters
- M: A scalar value that the function will search for in the first column of the table
Tab
.
- Tab: A matrix where the function searches for the scalar
M
in the first column. The name of the table is significant for error messages.
- takelarg: An optional boolean parameter. If set to true, the function will return the nearest larger value if an exact match is not found. The default value is true.
Output
- TL: The row from the table
Tab
that corresponds to the scalar M
or the nearest value based on the takelarg
parameter.
Algorithm Steps
- The function begins by setting the
takelarg
parameter using the getfuncparams
function, which defaults to true if not specified.
- It determines the number of rows in the table
Tab
.
- The function iterates over each row of the table to check if the first column matches the scalar
M
. If a match is found, it returns the entire row as TL
.
- If no exact match is found and
takelarg
is true, the function searches for the first row where the first column is greater than or equal to M
and returns that row.
- If
takelarg
is false, the function searches for the last row where the first column is less than or equal to M
. If such a row is found, it returns that row. If no such row exists, it throws an error indicating that no suitable value was found.
- Finally, if no exact match is found, a debug message is printed indicating that the nearest value was returned instead.
Algorithm explaination created using ChatGPT on 2025-08-19 01:26. (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