Comparing arrays using loop?
Show older comments
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)
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!