concatenate values from matrix and cell array
显示 更早的评论
i have a matrix and a cell array
mtric =
1 2 3
4 5 6
7 8 9
cell_array =
aa bb cc
dd ee ff
gg hh ii
i wanted to combine both these as
new_out =
1 - aa 2 - bb 3 - cc
4 - dd 5 - ee 6 - ff
7 - gg 8 - hh 9 - ii
采纳的回答
更多回答(1 个)
madhan ravi
2019-4-3
strcat(""+mtric,{'-'}, string(cell_array)) % string array
cellstr(strcat(""+mtric,{'-'}, string(cell_array))) % cell array
4 个评论
Elysi Cochin
2019-4-3
madhan ravi
2019-4-3
Which version of matlab are you using? If not use string() instead of "".
Elysi Cochin
2019-4-3
编辑:Elysi Cochin
2019-4-3
madhan ravi
2019-4-3
strcat(sprintfc('%d',mtric),{'-'},cell_array)
类别
在 帮助中心 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!