Comparing arrays using loop?
이전 댓글 표시
I need some help on assigning some codes. Say I have three matrices.
Matrix1= [cat;dog;hamster]
Matrix2=[7,6,1,5,8,1,9;4,6,10,15,8,1,9;3,6,25,5,8,4,10] %(this matrix represents how long a person watched them in their container).
Matrix3= [4,6,1,1,3,1,6;4,2,3,1,4,1,6;3,6,10,5,4,4,10] %(this matrix reprsents how many pets sold).
And each row in Matrix2 and Matrix 3 corresponds to the animal in that row in Matrix1 (ie. row 3 in Matrix2 and Matrix3 is for the hamster). How do i write a loop that says that if the total time watched is over 50 and amount sold is over 30 means that that pet is the most popular? I'm mainly stuck on where to put the FOR loop index (ie. for x=1:3)
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!