rcmod1

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 3.9, Creation date: 2017-06-16, Last change: 2025-09-14

return rows and colum for a given number and col length

Description

Useful for subplot indi

See Also: mod1 , modn

Example Illustration

 missing image of rcmod1(n,cx,sq)

Syntax

rc=rcmod1(n,cx,[sq])

Input Parameter

n: index
cx: number of cols
sq: if true; cx is the length of a squared field; default is false

Output Parameter

rc: [row col] =[1... 1...]




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 algorithm is a MATLAB function named rcmod1 that calculates the row and column indices for a given index and column length. It is useful for determining subplot indices.

Input Parameters

Output

Algorithm Steps

  1. Initialize the variable sq to false.
  2. Check if the number of input arguments is greater than or equal to 3 and if the third argument is not empty. If both conditions are true, set sq to the value of the third argument.
  3. If sq is true, calculate cx as the ceiling of the square root of cx.
  4. Calculate the row index r as the ceiling of n divided by cx.
  5. Calculate the column index c using the function mod1 with arguments n and cx.
  6. Return the result rc as a vector containing [r c].
Algorithm explaination created using ChatGPT on 2025-08-18 22:15. (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