adding values in array

1 Ansicht (letzte 30 Tage)
Mohammad Golam Kibria
Mohammad Golam Kibria am 8 Sep. 2011
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

Akzeptierte Antwort

Yoav Livneh
Yoav Livneh am 8 Sep. 2011
If idx1 and idx2 are row vectors you can do
idx3 = [idx1 idx2];
If they are column vectors do
idx3 = [idx1; idx2];
  1 Kommentar
Jan
Jan am 8 Sep. 2011
And if you don't know the orientation of the vectors: idx3 = cat(1, idx1(:), idex2(:)).

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Adding custom doc finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by