Need help alternating equations

I have 3 matrices that are 6x1.
A= [2,6,2,4,8,9]
B= [1,3,1,2,2,3]
C= [2,2,1,1,4,1]
I want to divide element 1 in matrix A by element 1 in matrix B, then element 2 in matrix A by element 2 in matrix C. Then I want to divide element 3 in matrix A by element 3 in matrix C...and so on.
In the end I want...
D= [1,3,2,4,4,9]

 採用された回答

Matt J
Matt J 2015 年 7 月 16 日
編集済み: Matt J 2015 年 7 月 16 日

0 投票

D=nan(size(A));
D(1:2:end)=A(1:2:end)./B(1:2:end);
D(2:2:end)=A(2:2:end)./C(2:2:end);

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

質問済み:

2015 年 7 月 16 日

編集済み:

2015 年 7 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by