xpstrings2cells
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Artificial Intelligence
Introduced first in SolidGeometry 5.4, Creation date: 2023-12-11, Last change: 2025-09-15
converts a char chain with quation mark separated sentences into a cell list of character chains
Description
RESULT IS LIKE: {'space on a'} {'a on table'} {'space on b'}
This function may accelerate the XPSEQS concept at a later stage.
functions such as contains work on charchain level
contains(xpstrings2cells(zzz),unsortrows(xpstrings2cells('"c on table"'))')
functions such as ismember work on cell level
See Also: xpstrings2cells
, XPcells2strings
Example Illustration
Syntax
ccc=xpstrings2cells(sss)
Input Parameter
sss: | | sentences separate by quotation marks such as '"a on b" "b on c"' |
Output Parameter
ccc: | | cell list of sentences such as [{'space on a'} {'a on table'}] |
Examples
sss='"space on a" "a on table" "space on b"'
xpstrings2cells(sss); ccc=ans
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, xpstrings2cells, is designed to convert a string of sentences separated by quotation marks into a cell array of character strings. It is part of the SolidGeometry library and was introduced in version 5.4.
Input Parameters
- sss: A string containing sentences separated by quotation marks, such as
'"a on b" "b on c"'.
Output Results
- ccc: A cell array of sentences, for example,
[{'space on a'} {'a on table'}].
Algorithm Steps
- The function begins by using the
split function to divide the input string sss at each quotation mark. This results in an array of strings.
- Next, the function uses
ismember in combination with strtrim to remove any empty strings from the array. strtrim is used to remove any leading or trailing whitespace from each string.
- The resulting array, now free of empty strings, is transposed to ensure it is in the correct format for a cell array.
- The final output is a cell array
ccc containing the individual sentences.
Example
Given the input sss='"space on a" "a on table" "space on b"', the function will output ccc as [{'space on a'} {'a on table'} {'space on b'}].
Algorithm explaination created using ChatGPT on 2025-08-19 00:14. (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