by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 4.3, Creation date: 2018-10-30, Last change: 2025-09-14
See Also:
cs=cellsize(C);
C): | cell array |
cs: | size of array |
loadweb JACO_robot.mat;
FS=FSofSG(JCF), size(FS)
cellsize(FS)
cellsize(FS')
cellsize({[1 ],[3 2] [2 3 1] [2]})
This algorithm is a MATLAB function named cellsize that calculates the size of each element within a cell array. It is part of the SolidGeometry library and was introduced in version 4.3.
C.The function begins by initializing an array cs with zeros, having the same size as the input cell array C. This is done using the zeros function, which creates an array of zeros with dimensions matching C.
The function then enters a for loop that iterates over each element of the cell array C. The loop runs from 1 to the total number of elements in C, which is determined using the numel function.
Within the loop, the function calculates the number of elements in each cell of C using numel(C{i}) and assigns this value to the corresponding position in the cs array. This effectively stores the size of each cell element in cs.
After the loop completes, the function returns the cs array, which contains the sizes of all elements in the input cell array C.
The function can be used as follows:
loadweb JACO_robot.mat;FS=FSofSG(JCF), size(FS)cellsize(FS)cellsize(FS')cellsize({[1 ],[3 2] [2 3 1] [2]})