필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

hi, im tring to make a new vector from some exics one.

조회 수: 1 (최근 30일)
Ariela Glikman
Ariela Glikman 2018년 11월 19일
마감: MATLAB Answer Bot 2021년 8월 20일
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

답변 (2개)

madhan ravi
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

Stephen23
Stephen23 2018년 11월 19일
The MATLAB way:
>> grades = [87,81,87,80,94,87,62];
>> sch = grades(grades>85)
sch =
87 87 94 87

이 질문은 마감되었습니다.

제품


릴리스

R2016a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by