adding values in array

조회 수: 1 (최근 30일)
Mohammad Golam Kibria
Mohammad Golam Kibria 2011년 9월 8일
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

채택된 답변

Yoav Livneh
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
Jan 2011년 9월 8일
And if you don't know the orientation of the vectors: idx3 = cat(1, idx1(:), idex2(:)).

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Adding custom doc에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by