I have a code but now sure how it works please help

[C,I]=max(sum(a,2));
can some body explain how variables C and I change in 3x3 matrix. thanks in advance

 채택된 답변

Geoff Hayes
Geoff Hayes 2014년 10월 8일
Etan - is a the 3x3 matrix that you are referring to? If it is, then
sum(a,2)
calculates the sum of each row, returning a 3x1 column vector. Then
[C,I]=max(sum(a,2));
will set C to the max element in that 3x1 vector, with I the index of that max element in the vector (so a value between 1 and 3, since there are three rows).

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

2014년 10월 7일

댓글:

2014년 10월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by