Info
This question is closed. Reopen it to edit or answer.
hi, im tring to make a new vector from some exics one.
1 view (last 30 days)
Show older comments
grades= [87 81 87 80 94 87 62];
scholarship=[];
for i=i:length(grades)
if (grades (i)>85)
scholarship(i)=grades (i);
i=1+i;
else
i=1+i;
end
end
0 Comments
Answers (2)
madhan ravi
on 19 Nov 2018
Edited: madhan ravi
on 19 Nov 2018
grades= [87 81 87 80 94 87 62];
scholarship=[];
ctr=1;
for i=1:length(grades)
if (grades(i)>85)
scholarship(ctr)=grades(i);
ctr=ctr+1;
end
end
scholarship
0 Comments
Stephen23
on 19 Nov 2018
The MATLAB way:
>> grades = [87,81,87,80,94,87,62];
>> sch = grades(grades>85)
sch =
87 87 94 87
0 Comments
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!