NEED HELP QUICK PLEASE

조회 수: 1 (최근 30일)
Akhil Uddandam
Akhil Uddandam 2015년 2월 14일
댓글: Image Analyst 2015년 2월 14일
Hi so I have a matrix (51x22) of values and a name matirx that line up with each of those vaules with a state name (51x1). I need to find the state with the greatest values. You are told to find the sum of each row and somehow make matlab find the one with the greatest sum and identify that row with name of the state in the other matrix that has names of states in it. ex. A={1 2 3; 4 5 6; 5 7 8] B=[albama; Calif; Iowa]
since the third row has the most sum, I need matlab to first find the sum of each row in A and determine which has the greatest sum and then Identify the name of the state with the identy matrix B. THank you

채택된 답변

Image Analyst
Image Analyst 2015년 2월 14일
What does this have to do with the Coder product???
Also, read this.
Hint: use sum(yourArray, 2) and the max() function (both return arguments of it). That should be enough hints for a smart engineer like you to solve it. If you still need help with your homework, post your attempt at the code.
  댓글 수: 2
Akhil Uddandam
Akhil Uddandam 2015년 2월 14일
편집: Akhil Uddandam 2015년 2월 14일
Thank you for the help. Once you have max sum in the row how can compare/ idetify with which row it is coming from in the identity matrix B. Thank you, your really saving my life!
Like lets say I sum(yourArray, 2) and the max() and I get max is 50 how can I make mat lab know that say that max is from row 10 and on the identity matrix B row 10 is Iowa. So it tells me it is Iowa.
Image Analyst
Image Analyst 2015년 2월 14일
Akhil, did you look up the help for max() and see what the two arguments I mentioned are? Evidently not because one of the return arguments is the location (row index) of the max!!!
You didn't post your attempt at code like I asked for if you needed any more help. And since you didn't answer about Coder I'm going to assume it has nothing whatsoever with it and remove that tag.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by