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
- n: The index for which the row and column need to be determined.
- cx: The number of columns.
- sq (optional): A boolean flag. If true,
cx
is treated as the length of a squared field. The default value is false.
Output
- rc: A vector containing the row and column indices in the format
[row col]
.
Algorithm Steps
- Initialize the variable
sq
to false.
- 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.
- If
sq
is true, calculate cx
as the ceiling of the square root of cx
.
- Calculate the row index
r
as the ceiling of n
divided by cx
.
- Calculate the column index
c
using the function mod1
with arguments n
and cx
.
- 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