C KAMALESWAR REDDY - MATLAB Cody - MATLAB Central

C KAMALESWAR REDDY

9181
Rank
4
Badges
630
Score
1 – 50 of 65

C KAMALESWAR REDDY received Introduction to MATLAB Master badge

on 2 Aug 2021

C KAMALESWAR REDDY submitted a Comment to Problem 44952. Find MPG of Lightest Cars

function mpg = sort_cars(N) wgt=[cars.Weight]' ; mpg1=[cars.MPG]'; mpg2=zeros(1,length(wgt)); for i=1:length(wgt) [wgt1 inx]=max(wgt); mpg2(end-i+1)=mpg1(inx); wgt(inx)=0; end mpg = mpg2(1:N); end The above code is my solution, but it is not compiling can anyone help me with this..

on 1 Aug 2021

1 – 50 of 65
Go to top of page