select parts of vector with loops

1 回表示 (過去 30 日間)
jj27
jj27 2018 年 10 月 12 日
回答済み: Nicolas Schmit 2018 年 10 月 15 日
So I know this is basic matlab stuff but I don't get it right now. lets say i have vector Y, now i want to remove values below a certain vallue from the first ten data points the second ten data points etc. I have to put in a loop so I can add more functions to it. What i mean is select from Y point 1:10,11:20,21:30 etc and do it with a loop.
Can someone help?
  1 件のコメント
Stephen23
Stephen23 2018 年 10 月 12 日
@ Kjell Lemmen: it is not very clear what you are trying to do. Please show us an example, complete with both input and output vectors.

サインインしてコメントする。

採用された回答

Nicolas Schmit
Nicolas Schmit 2018 年 10 月 15 日
Y = rand(100, 3);
d = 10;
for k=1:size(Y, 1)/d
% Select a chunk of data from Y
index = d*(k-1)+1:d*k;
Ytemp = Y(index, :);
% Do what you want to Ytemp
% Put the data back in Y
Y(index, :) = Ytemp;
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by