division of consecutive numbers

3 ビュー (過去 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 Center および File ExchangeElectrical and Computer Engineering についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by