You should use logical indexing to obtain the prices in a 30 minute range:
data(0 < data(:,2) & data(:,2) < 31, 3)
Why find doesn't do what you expect?
find
works on the result of the following expression 0 < data(:,2) & data(:,2) < 31
, i.e. [1 1 1 1].'
It doesn't know anything about the original matrix data
. Therefore, the second and third argument are useless in this case. They would be useful to obtain the nonzero elements in a matrix.
As a (less efficient) alternative to logical indexing, you can obtain the same result as follows:
data(find(0 < data(:,2) & data(:,2) < 31 ), 3)
Selecting a specific hour
At the moment, you select the prices for the first half of each hour. To select for example the prices between 00:00 and 00:30, you could use the following:
data(data(:,1) == 0 && 0 < data(:,2) & data(:,2) < 31, 3)