how can i find row position for minimum value that changes every cycle. each cycle has 100 data points( 100*1 matrix).
1 次查看(过去 30 天)
显示 更早的评论
example: 1st 100 data points (1 to 100)- minimum is at 20th row 2nd 100 data points (101 to 200) - minimum is at 150th row. and so on. I have 6000 cycles. How do I find the minimum for each cycle and their position?
0 个评论
采纳的回答
Jan
2017-4-19
编辑:Jan
2017-4-19
X = rand(1, 6000);
[minValue, minIndex] = min(reshape(X, 100, []));
Now the minIndex is related to each block. To get the absolute positions relative to X:
minIndex = minIndex + 0:numel(minIndex) - 1;
5 个评论
Jan
2017-4-20
This means, that you want to roll the vector to the left - correctly?
X = rand(1, 6000);
Y = reshape(X, 100, []);
[minValue, minIndex] = min(Y);
for k = 1:size(Y, 2)
Y(:, k) = circshift(Y(:, k), 1 - minIndex(k));
end
更多回答(1 个)
Are Mjaavatten
2017-4-19
You could arrange your 6000 data cycles in a 100 by 6000 matrix and use the min function. Example, using only 10 cycles:
X = rand(100,10):
min_values = min(X);
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!