sss=xpcells2strings(ccc)
ccc : | cell list of sentences such as [{'space on a'} {'a on table'}] |
sss : | sentences separate by quotation marks |
ccc=[{'space on a'} {'a on table'} {'space on b'}]
sss='"space on a" "a on table" "space on b" "b on table" "space on c" "c on table"'
xpcells2strings(ccc); sss=ans;
This function, XPcells2strings
, is designed to convert a cell array of character strings into a single string where each sentence is separated by quotation marks. It is part of the SolidGeometry library and was introduced in version 5.4.
[{'space on a'} {'a on table'}]
.ccc
is [{'space on a'} {'a on table'}]
, the output sss
will be "space on a" "a on table"
.ccc
.join
function to concatenate the elements of ccc
into a single string, with each element separated by " "
(a space enclosed in quotation marks).join
function is a cell array with one element, which is accessed using sss{1}
.sprintf
function is then used to format this string by enclosing it in quotation marks, resulting in the final output sss
.Given the input:
ccc = [{'space on a'} {'a on table'} {'space on b'}]
The function will produce the output:
sss = '"space on a" "a on table" "space on b"'
This function is useful for operations that require a single string format, such as when using functions like contains
or ismember
that operate on character chains or cell levels, respectively.