division of consecutive numbers

조회 수: 2 (최근 30일)
nayana k
nayana k 2020년 1월 30일
댓글: nayana k 2020년 1월 31일
I have a set 120 values and i want to take 1st 4 values and divide with a ref. no.and check for a condition if it is not satisfied i want to take next 4 values and repeat like this by using for loop.can u plz help.

채택된 답변

Bhaskar R
Bhaskar R 2020년 1월 30일
y = randi(100, 1, 120); % assumed data of length 120
for ii = 1:4:length(y)
values_4 = y(ii:ii+3); % fou
if mean(values_4) ~= 10 % assumed condition here
% your operation
else
break; % operation breaks here
end
end
  댓글 수: 3
Walter Roberson
Walter Roberson 2020년 1월 30일
for i=1:4:120
for j=i:i+3
end
end
nayana k
nayana k 2020년 1월 31일
Thanku sir .

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by