views:

24

answers:

1

This one has me stumped, and none of the other related questions here have given me clues. I'm using regexp to parse a string. When I print t afterward, it looks something like this:

t = { [1,1] = { [1,1] = HELLO [1,2] = 1234 } }

I would like to be able to pull out the HELLO and 1234. I've tried all different ways to access the elements in the nested matrix, but am not having any luck. I can't even find it in the Octave documentation! Can someone please help me out? Thank you!

A: 

I believe this is the answer -- regexp doesn't return a matrix, it returns a cell array. I just have to use {} to get access to the data. i.e. to get HELLO, it is t{1}{1}. To get 1234 it is t{1}{2}.

http://www.gnu.org/software/octave/doc/interpreter/Cell-Arrays.html

Dave