array2cell

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 4.4, Creation date: 2018-12-28, Last change: 2025-09-14

convert object arrays into cell arrays

Description

Think also about
{a.name}' % fasten than elem2rows
{a.name} % faster than elem2cols
[a.datenum] % rows
[a.datenum]' % cols

See Also: , arrayof , cell2class , class2cell

Example Illustration

 missing image of array2cell(array)

Syntax

c=array2cell([array])

Input Parameter

array: arrays of structs

Output Parameter

c: cell list of input values

Examples


a=dir(pwd);
array2cell(a.name)
{a.name}' % fasten than elem2rows
{a.name} % faster than elem2cols
[a.datenum] % rows
[a.datenum]' % cols




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, array2cell, is designed to convert object arrays into cell arrays. It is part of the SolidGeometry library and was introduced in version 4.4. The function is authored by Tim Lueth and is classified under auxiliary procedures.

Input Parameters

Output Results

Function Explanation

The function array2cell is defined to take a variable number of input arguments using varargin. The main operation performed by the function is to transpose the input arguments and assign them to the output variable c. This effectively converts the input array into a cell array.

Example Usage

An example provided in the comments demonstrates how to use the function:

a = dir(pwd); 
array2cell(a.name)

In this example, the dir function is used to get a list of files and directories in the current working directory. The array2cell function is then used to convert the names of these files and directories into a cell array.

Related Functions

The function documentation mentions several related functions that might be of interest:

These functions are likely part of the same library and may offer complementary functionality for handling arrays and cell arrays.

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