From: LFG Tech on 15 Mar 2010 06:43 Hello Friends, Suppose i have a mtrix x = [1 2 3 4; 5 6 7 8; 9 8 5 9; 7 7 7 7]; now I want to find the number of times the maximum value(in this case 9) appears.Also i wld like to get the coordinates of them (in this case 3,1 and 3,4). thanks, LFG
From: Sadik on 15 Mar 2010 06:53 Hi, maxValue = max(x(:)); [m,n] = find(x==maxValue); numberOfMaxValues = length(m); m will be [3;3] and n will be [1;4]. So if you want to see the coordinates side by side, you can do coordinates = [m,n]; so that coordinates will be a 2-column matrix. Best.
|
Pages: 1 Prev: Updating my loop Next: function intersect is not working.... |