Clear Filters
Clear Filters

division of consecutive numbers

2 views (last 30 days)
nayana k
nayana k on 30 Jan 2020
Commented: nayana k on 31 Jan 2020
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.

Accepted Answer

Bhaskar R
Bhaskar R on 30 Jan 2020
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 Comments

Sign in to comment.

More Answers (0)

Categories

Find more on Simulink in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!