How do I do this

1 view (last 30 days)
Aaron Peng
Aaron Peng on 12 Oct 2015
Answered: Geoff Hayes on 12 Oct 2015
This question just seems impossible to me. Can someone help me by just telling me how to start? I don't want someone to do it for me, I just want to know how to start it.

Answers (1)

Geoff Hayes
Geoff Hayes on 12 Oct 2015
Aaron - the idea is to iterate over each column and determine which element/value is the smallest. You need to keep track of this value and which row it came from so that you can populate the output matrix. Use a for loop to iterate over each row in that column. Since you have multiple columns, you will want to use an outer for loop to iterate over each column with an inner for loop to iterate over each row of that column. First determine the dimensions (number of rows and columns) of your matrix using the size function, and then code up your two for loops using the two values returned from this function call. You will want to store each minimum value in another array, so I suggest that you create that (i.e. pre-size it) before you enter the outer for loop. Try coding it up and then reply back here if you require more help.

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!