Error using movmax index
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I need to find the number of periods since a stock price recorded an 14-day high. My proposed method was to use the following andpossibly subtract the index from the current row:
n = 14
[M,I] = movmax(high,[n-1 0],'omitnan');
However, I return - "error using movmax. Too many output arguments."
Can someone please assist in my methodology.
0 Kommentare
Antworten (1)
Walter Roberson
am 21 Feb. 2021
There is no syntax for movmax() in which it returns a second output. It does not return the indices of the local maxima.
4 Kommentare
Walter Roberson
am 10 Jun. 2021
wid = 5;
N = 50;
signal = randi([-9, 9], 1, N)
for K = 1 : N - wid + 1
[M(K), relI] = max(signal(K:K+wid-1));
I(K) = K + relI - 1;
end
M
I
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!