How to use a floating point number in max() function?
3 views (last 30 days)
Show older comments
Hi, I am trying to find a maximum number that is a float number using max().
allWidths = bb(3:4:end);
allHeights = bb(4:4:end);
aspectRatio = [allWidths./allHeights ; allHeights ./ allWidths];
aspectRatios = max(aspectRatio, [], 0.5);
but the line
aspectRatios = max(aspectRatio, [], 0.5);
shows an error. How could I use a floating point number to find the maximum value??
2 Comments
Accepted Answer
Stephen23
on 13 Aug 2017
aspectRatio = allWidths./allHeights;
idx = aspectRatio>0.5 & aspectRatio<1.5;
find is likely not required, as logical indexing is simpler and more efficient.
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!