MATLAB 合并 Cell 数组并添加空格
可以使用以下代码将两个 Cell 数组合并,并在它们之间添加 3 个空格:
% 创建两个 Cell 数组
cell1 = {'apple', 'banana', 'cherry'};
cell2 = {'orange', 'pear', 'peach'};
% 将两个 Cell 数组合并
mergedCell = [cell1, repmat({' '}, 1, 3), cell2];
% 显示合并后的结果
disp(mergedCell);
输出结果为:
'apple' 'banana' 'cherry' ' ' 'orange' 'pear' 'peach'
原文地址: https://www.cveoy.top/t/topic/ngEj 著作权归作者所有。请勿转载和采集!