mat2celldim3

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Kinematics and Frames
Introduced first in SolidGeometry 5.2, Creation date: 2022-04-10, Last change: 2025-09-15

converts an [a:b:n] array into a cell list {n x [a b]}

Description

matlabs version supports only dim2
In the SG-Lib frames are 4x4 homogenous transformation matrices. Nevertheless by development-over-time reasons, there are 3 different concepts for lists of frames
CELL FORMAT A cell list of [4x4] matrices {T1,T2,...}
ARRAY FORMAT An array of [4x4xn] matrices
LONG LIST FORMAT A long array list of [n*4 x 4] (should be avoided)

See Also: , cell2array , cell2matdim3 , TLL2TL

Example Illustration

 missing image of mat2celldim3(TL)

Syntax

NL=mat2celldim3(TL)

Input Parameter

TL: [4 x 4 x n] array of n 4x4 frames

Output Parameter

NL: cell list of [4x4 frames

Examples


TcopyVLez(PL,'','',[pi/20 pi/30 pi/10]); TL=ans; SGcopyTL(SGbox(2),TL);
TL
mat2celldim3(TL)


PL=PLsquare(40), TcopyVLez(PL);TL=ans;
TLC=mat2celldim3(TL)
TLL=cell2mat(TLC)
TLA=cell2matdim3(TLC)
TLC=mat2celldim3(TLL)
TLA=cell2matdim3(TLC)




Copyright 2022-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, mat2celldim3, is designed to convert a 3D array of 4x4 matrices into a cell array format. It is part of the SG-Library and is used to handle different formats of transformation matrices.

Input Parameters

Output

Algorithm Steps

  1. Check if the first dimension of TL is greater than 4. If true, it indicates that TL is in a "Long List" format.
  2. If in "Long List" format, reshape TL into a 3D array of [4 x 4 x n] using rot90 and reshape functions.
  3. Check if TL is numeric and has at least one 4x4 matrix along the third dimension.
  4. Determine the number of matrices, nt, by checking the size of the third dimension of TL.
  5. Initialize a cell array NL with nt cells.
  6. Iterate over each matrix in TL and assign it to the corresponding cell in NL.

Example Usage

The function is used to convert a 3D array of transformation matrices into a cell array format, which can then be used with other functions like cell2matdim3 or TLL2TL.

Algorithm explaination created using ChatGPT on 2025-08-19 07:23. (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