フィルターのクリア

Data

1 回表示 (過去 30 日間)
Mate 2u
Mate 2u 2012 年 5 月 4 日
Hi there, I have a 6 million x 1 array of prices. I want to change it so that it is +1 if P+1 > P, -1 if P-1 <P and 0 if P+1=P
  2 件のコメント
Mate 2u
Mate 2u 2012 年 5 月 4 日
Additionally would prefer if algorithm is quick.
Daniel Shub
Daniel Shub 2012 年 5 月 4 日
What happens if P < P+1 and P > P-1?

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

採用された回答

Andrei Bobrov
Andrei Bobrov 2012 年 5 月 4 日
sign(diff(P));
  3 件のコメント
Andrei Bobrov
Andrei Bobrov 2012 年 5 月 4 日
hence P(ii) == P(ii + 1)
Daniel Shub
Daniel Shub 2012 年 5 月 4 日
@Mate, the documentation for sign clearly states that sign(0) is 0.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWhos についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by