Creating m by 2 matrix
Show older comments
For the following coding problem you may now use the functions rref, size, zeros, and eye. Produce a Matlab function that takes an m n matrix A and produces an m 2 matrix M, where the kth row of the matrix M is [x y] where x is the largest entry in row k of A, and y is the column containing the the entry x. If multiple columns of row k contain the entry x, then y should be the leftmost column of row k with entry x.
4 Comments
Walter Roberson
on 25 Sep 2021
Looks like homework. What have you accomplished so far?
Kojo Anim
on 25 Sep 2021
Image Analyst
on 25 Sep 2021
"I can demonstrate with examples what the problem seeks to achieve." How? Pen and paper? Not code?
Answers (1)
David Hill
on 25 Sep 2021
[a,b]=max(A,[],2);
M=[a,b];
2 Comments
Walter Roberson
on 25 Sep 2021
note that this is obviously a homework question
David Hill
on 25 Sep 2021
That is why I didn't really answer the question.
Categories
Find more on Resizing and Reshaping Matrices 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!