1

I was wondering if somebody could tell me which is the equivalent of the function selectifr from Ox in Matlab ?

for(i = 1; i <= sizeof(vdates); i = i+1)
    daily_file = selectifr([bid,ask], dates .== vdates[i]);
    if empty continue
    save daily_file contract_name + "_" + sprint(vdates[i]) ;

How do I translate this program into Matlab?

R. Martinho Fernandes
  • 228,013
  • 71
  • 433
  • 510
Lauritta
  • 19
  • 4

1 Answers1

1

I've never used Ox but after a quick google search going from the docs.

The selectifr function returns an s x n matrix, 
selecting only those rows from ma which have at least one non-zero element 
in the corresponding row of mifr. 

Where in the function selectifr(const ma, const mifr);

ma = m x n matrix to select from

mifr = m x q boolean matrix specifying rows to select

So essentially you are picking specify dates of the [bid,ask]. In term's of matlab, I think an intersect of union might be what you need here

pyCthon
  • 11,746
  • 20
  • 73
  • 135
  • I have a intraday 5 minutes data and need to split 900,000 rows(bid,ask, data)in either a vector nxm(n rows(bid,ask),m columns(here I know there are 1259 days))..Or either a vector for each day that should take the prices(bid,ask) acording to the dates..I cannot use the function reshape because in one day I have more observations and in another less.(I don't know which are the days when the obervations are not the same). – Lauritta Sep 11 '13 at 04:19
  • @MarinelaFinta what format do you have the data stored and how are you loading it? – pyCthon Sep 11 '13 at 22:02
  • So I have a nx1(n=935039) vector of the data like this: 734142 734142 734142 734142 734142 734143 734143 734143 734143 734143 734143 734143 734143 734143.. Then a vector with prices:1115.80000000000 1115.40000000000 1116 1116 1115.80000000000 1115.70000000000 1115.70000000000 1115.40000000000 1115.60000000000 1115.60000000000 1115.70000000000 1115.60000000000 1115.80000000000 1115.80000000000 1115.70000000000 correpondig to each date... – Lauritta Sep 11 '13 at 23:17
  • There is no way to split them either in one matrix with I don't know how many rows(which are gonna be the prices for each day) but I know the number of columns 1260(which are the days I have).. Or if not just to make 1260 vectors(nx1) with the prices for each day. – Lauritta Sep 11 '13 at 23:17