可以使用 'cell2mat' 函数将 Cell 中的数据转换为字符串。

例如,有一个 Cell 数组如下:

'cell_arr' = {'hello', 'world', '!', 123};

可以使用如下代码将其转换为一个字符串:

'str' = cell2mat(cell_arr)

输出结果为:

'str' = helloworld!123

需要注意的是,'cell2mat' 函数只能将 Cell 中的数据转换成字符型或数值型,如果有其他类型的数据,会报错。

MATLAB: 如何将 Cell 数组中的数据转换为字符串

原文地址: https://www.cveoy.top/t/topic/ngGh 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录