MATLAB: 如何将 Cell 数组数据转换为字符串
可以使用 cell2mat 函数将 Cell 数组转换为字符数组。如果 Cell 数组中的元素不是字符数组,则需要使用 cellfun 函数将其转换为字符数组。例如:
C = {'hello', 123, [1 2 3]}; str = cell2mat(cellfun(@(x) num2str(x), C, 'UniformOutput', false))
输出结果为:'hello123123'
原文地址: https://www.cveoy.top/t/topic/ngGa 著作权归作者所有。请勿转载和采集!