Info
此问题已关闭。 请重新打开它进行编辑或回答。
Find minimum of $n$ first entries, with $1\leq n\leq numel(X)$.
2 次查看(过去 30 天)
显示 更早的评论
Given a one-dimensional array $X$, is there a fast way (faster than a for loop) to find $min_{1\leq m\leq n} X(m)$ for all $1\leq n\leq numel(X)$?
回答(2 个)
Mischa Kim
2016-9-19
Bananach, use min :
X = rand(1,10)
X =
0.6557 0.0357 0.8491 0.9340 0.6787 0.7577 0.7431 0.3922 0.6555 0.1712
min_X = min(X(1:6)) % find the minumum of the first 6 entries
min_X =
0.0357
1 个评论
此问题已关闭。
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!