How to add numeric values to cell array?
23 次查看(过去 30 天)
显示 更早的评论
names = {'A' 'B' 'C' 'D' 'E'};
val = [0;1.5;0.5;0.5;1.5]
I want my output as folows
A 0
B 1.5
C 0.5
D 0.5
E 1.5
0 个评论
采纳的回答
Star Strider
2021-4-7
Try this:
names = {'A' 'B' 'C' 'D' 'E'};
val = [0;1.5;0.5;0.5;1.5];
C = {[names{:}].' val}
C1 = C{:,1}
C2 = C{:,2}
TC = table(C1,C2)
.
更多回答(1 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!