division of consecutive numbers

1 次查看(过去 30 天)
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 个评论

请先登录,再进行评论。

更多回答(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