how to find and add a matrix values from another matrix???

1 回表示 (過去 30 日間)
suchismita
suchismita 2015 年 11 月 22 日
編集済み: Image Analyst 2015 年 11 月 22 日
I have a matrix A which holds the positions, which further i want to add from matrix B.
for example :
A=[1 2 5]
B=[ 0 0 9 0 10
0 0 9 0 10
9 9 0 9 9
0 0 9 0 10
10 10 10 10 0]
from B's first row i want to add 1st 2nd and [4] 5th elements the answer will be 0+0+10
A matrix represents the position to be added in B

採用された回答

dpb
dpb 2015 年 11 月 22 日
編集済み: Image Analyst 2015 年 11 月 22 日
C=sum(B(1,A));
Open the online doc and under "Getting Started" read tutorial info on Array Indexing. I recommend working thru this introductory info in sequence to get going in Matlab quickly...

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by