Ivan
Ivan

Reputation: 7746

Extract the string in a struct of arrays

I have a struct of arrays.

ci = tdfread(pathToData, delimiter)

disp(ci) give this

                 time: [11513x19 char]
                  bid: [11513x1 double]
            bid_depth: [11513x1 double]
      bid_depth_total: [11513x1 double]
                offer: [11513x1 double]
          offer_depth: [11513x1 double]
    offer_depth_total: [11513x1 double]

I can loop through the structure of arrays for the doubles fine, but time code below ci.time(row) just returns the first character of the string not the whole string. How do I get the whole string per row?

foundOpen = false;
row = 1;
while(false == foundOpen)
   t = ci.time(row)
   Bid = ci.bid(row)
   Ask = ci.offer(row)
   dt = datetime(t)
   h = hour(dt)
   if h > 12
       foundOpen = true;
   end

   row = row + 1;
end

Upvotes: 1

Views: 82

Answers (1)

badjr
badjr

Reputation: 2286

Try using the colon operator:

ci.time(row, :)

Upvotes: 1

Related Questions