Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

How to detect a numerical pattern?

1 view (last 30 days)
Damo Nair
Damo Nair on 4 Feb 2017
Closed: MATLAB Answer Bot on 20 Aug 2021
Hi,
I have a data set that has 2 columns, states & prices. Like this ...
prices = [-1.5 -1.2 -2 -2.4 -1.3 -0.2 -0.6 -0.6 0.8 1.8 2.4 2 1.9 1.88 3 3.7 4.2 4.1
4.5 3.3 3.5 2.6 1.5 1.4 1.7 1.6 2.4 2.9 3.4 3.3 3.8 2.9 2 1.8 1.5];
states = [1 2 1 1 2 2 2 2 2 4 4 4 3 2 4 4 4 4 4 4 4 2 2 2 2 2 4 4 4 4 4 2 2 2 2];
Now, after the last lowest state, i.e. 1 the prices move up, move down, go back up etc.
My question how can I detect these up & down moves with respect to state 1?
Right now I'm using really cumbersome commands like
f1 = find(t1(:,2) == 1, 1, 'last') &
fm = find(t1(:,1) == max(t1(:,1)) & t1(:,1) > f1) & run length on price difference.
And am not getting anywhere. Any easier, quicker way to detect these up & down moves?
Thanks
Damo.

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!