필터 지우기
필터 지우기

Mean between an interval

조회 수: 2 (최근 30일)
FG
FG 2020년 10월 8일
댓글: FG 2020년 10월 8일
I want to calculate the mean between a time interval that depends on a variable like P ;
F=[1 10 2 4 6 8];
for q=1:length(F);
P=F(q);
Average=mean(M3(90000-P*0.2*1732:90000));
'' Integer operands are required for colon operator when used as index'' warning is come.. What is the problem here ?
  댓글 수: 1
FG
FG 2020년 10월 8일
and how to solve it ?

댓글을 달려면 로그인하십시오.

채택된 답변

KSSV
KSSV 2020년 10월 8일
idx = round(90000-P*0.2*1732:90000) ;
Average=mean(M3(idx));
Your indices are not integers.....you got some fractions also.....so use round.

추가 답변 (1개)

madhan ravi
madhan ravi 2020년 10월 8일
x = 1:5;
x(.2) % error
x(2) % no error , index can only be integers not decimals
I suggest you to do MATLAB Onramp course.
  댓글 수: 1
FG
FG 2020년 10월 8일
OK, I will Madhan..

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by