adding values in array
2 次查看(过去 30 天)
显示 更早的评论
Hi suppose I have two variable
idx1=
1
2
3
idx2=
4
5
I need to have a third variable idx3 where idx3=
1
2
3
4
5
NB. idx1 and idx2 are linear indices and idx3 is the indices having all idx1 and idx2
0 个评论
采纳的回答
Yoav Livneh
2011-9-8
If idx1 and idx2 are row vectors you can do
idx3 = [idx1 idx2];
If they are column vectors do
idx3 = [idx1; idx2];
1 个评论
Jan
2011-9-8
And if you don't know the orientation of the vectors: idx3 = cat(1, idx1(:), idex2(:)).
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!