Combine two vectors together
显示 更早的评论
For example I got a = [1 3 5], b = [2 4] and I want to get a c = [1 2 3 4 5 ]
Basically it'd insert the vaule from b between a's two elements
回答(3 个)
KSSV
2020-4-20
iwant = sort([a, b])
Bruno Luong
2020-8-28
a(1:2:2*end-1) = a;
a(2*(1:length(b))) = b
Osip Vayner
2020-8-28
KSSV's code is correct.
And just in case you want to combine two vectors vertically:
d = sort([a;b])
类别
在 帮助中心 和 File Exchange 中查找有关 Polar Plots 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!