Finding the column of a matrix with the largest value
6 views (last 30 days)
Show older comments
Kevin Akash Rajasekaran
on 13 Jul 2021
Commented: Kevin Akash Rajasekaran
on 13 Jul 2021
Hey all! I have a 65X64 cell called 'spikes" with a range of numbers in it. What might be the best way to go about selecting the column (say for the first row only) with the largest element in it. I'm more interested in which column has the largest element rather than the element value itself. I've also attached a .mat file of the cell in question. Thanks in advance!
0 Comments
Accepted Answer
Simon Chan
on 13 Jul 2021
Try this,
A = load('spikes.mat');
B = cell2mat(A.spikes);
[~,I] = max(max(B))
More Answers (1)
KSSV
on 13 Jul 2021
Read about the function max. Here you can specify the dimension in which you want a maximum value. Also max gives you the value and index of the element.
0 Comments
See Also
Categories
Find more on Entering Commands 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!