what wrong with the fallowing codes?
Show older comments
i have a 20*120 matrix for each column in the matrix i need to find the maximum value between all the values , and then sum the remaining values ,then i need to divide the maximum value by the summation of the remaining values. i tried this codes but the results were not correct what is the problem?
s=1:z %z=120
for i=1:x %x=20
maximss=max(Pres_W); %maximum value
InterFss=(sum(Pres_W))-maximss; %remaining values
SIRk(:,s)=(maximss(:,s))./(InterFss(:,s));
end
end
Accepted Answer
More Answers (1)
Image Analyst
on 22 May 2016
Here's the first part:
rows = 4;
columns = 20;
Pres_W = rand(rows, columns) $ Sample data.
% Get max in each column
columnMaxima = max(Pres_W, [], 1)
% Make same size as original matrix
columnMaxima = repmat(columnMaxima, [rows, 1])
% "find the maximum value between all the values"
differences = Pres_W - columnMaxima
maxDifference = max(differences(:))
But then I came to the instruction "sum the remaining values" and I had no idea what the remaining values were, and I couldn't see how your line of code gave the remaining values. Remaining after what???
Categories
Find more on Creating and Concatenating 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!