strarr2cell

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Artificial Intelligence
Introduced first in SolidGeometry 5.4, Creation date: 2023-12-07, Last change: 2025-09-15

converts a string array into a cell list of string

Description

Flight back from Hefei to Munich

See Also: cell2strarr , stringpatternpermute

Example Illustration

 missing image of strarr2cell(strarr,rememt)

Syntax

ccc=strarr2cell(strarr,[rememt])

Input Parameter

strarr: stringarray
rememt: if true, empty entries are removed

Output Parameter

ccc: cell list with string entries

Examples


clc; yyy={["c" "table" "space" "b" "a"];["ontop" "under" "between" ]}
cell2strarr(yyy); xxx=ans, strarr2cell(xxx)
cell2strarr(yyy); xxx=ans, strarr2cell(xxx,true) % no empty entries
cell2strarr(yyy); xxx=ans, strarr2cell(xxx,true); zzz=ans, permutevarargin(zzz{:}) % no empty entries




Copyright 2023-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, strarr2cell, converts a string array into a cell list of strings. It is part of the SolidGeometry library and was introduced in version 5.4. The function is designed to handle string arrays and optionally remove empty entries based on the input parameters.

Input Parameters

Output

Algorithm Steps

  1. Retrieve the rememt parameter using the getfuncparams function. If not provided, default to false.
  2. Determine the number of rows in the input string array strarr.
  3. Initialize a cell array ccc with the same number of rows as strarr.
  4. Iterate over each row of the string array:

Example Usage

The function can be used as follows:

clc; 
yyy = {["c" "table" "space" "b" "a"]; ["ontop" "under" "between"]};
cell2strarr(yyy); 
xxx = ans; 
strarr2cell(xxx);

cell2strarr(yyy); 
xxx = ans; 
strarr2cell(xxx, true);  % no empty entries

cell2strarr(yyy); 
xxx = ans; 
strarr2cell(xxx, true); 
zzz = ans; 
permutevarargin(zzz{:});  % no empty entries
Algorithm explaination created using ChatGPT on 2025-08-19 00:56. (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