Info
この質問は閉じられています。 編集または回答するには再度開いてください。
hi, im tring to make a new vector from some exics one.
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (2 件)
madhan ravi
2018 年 11 月 19 日
編集済み: madhan ravi
2018 年 11 月 19 日
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 件のコメント
Stephen23
2018 年 11 月 19 日
The MATLAB way:
>> grades = [87,81,87,80,94,87,62];
>> sch = grades(grades>85)
sch =
87 87 94 87
0 件のコメント
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!