Syntax
c=class2cell(objs)
Input Parameter
objs : | | object array of a class |
Output Parameter
c : | | cell list of the class array |
Examples
SGfigure; CPLplotasPS(CPLsample(14)); ps=PSofgca; ps=regions(ps) % array of polyshape
ps, cell2class(class2cell(ps))
Copyright 2018-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, class2cell
, is designed to convert an array of objects from a specific class into a cell array where each cell contains one object from the original array. The function is part of the SolidGeometry library and was introduced in version 4.4.
Input Parameters
- objs: This is an array of objects belonging to a specific class. The function will process each object in this array.
Output Results
- c: This is the resulting cell array. Each cell in this array contains one object from the input
objs
array.
Algorithm Steps
- Initialize a cell array
c
with the same size as the input object array objs
.
- Iterate over each element in the
objs
array using a for-loop.
- For each iteration, assign the current object from
objs
to the corresponding cell in c
.
- Continue this process until all objects have been transferred to the cell array.
Example Usage
The example provided in the comments demonstrates how to use the function in conjunction with other functions from the SolidGeometry library:
SGfigure;
CPLplotasPS(CPLsample(14));
ps = PSofgca;
ps = regions(ps); % array of polyshape
ps, cell2class(class2cell(ps))
In this example, a polyshape array ps
is converted to a cell array using class2cell
, and then back to its original form using cell2class
.
Algorithm explaination created using ChatGPT on 2025-08-18 22:39. (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