From: Joao Henriques on
Derek's answer is the right one for Matlab, it may be strange for someone with a different background (eg. C++, Java) but the only way to deal with this sort of data structures is to re-interpret them in terms of vectors or matrices. Sometimes it's not obvious how to do so, and the result is very inefficient and hard to maintain code because you're trying to hammer foreign concepts into ML! This may change as OOP matures within ML (but IMO it's not there right now).

You can keep your data structures tidy by using structs, I'll describe this at the end.

For the tree structure, if the number of children is fixed (for example, a binary tree), a tree with N nodes can be represented with an Nx2 matrix, where each row has the indexes of the children of each node (0 if none). This makes it easier to traverse from the root.

Another example is when dealing with general graphs. For a graph with N nodes and M arcs, you can store it as two length M vectors, "heads" and "tails" (an arc points from the head node to the tail node), with the indexes of the corresponding nodes. Node data is kept separately, typically in other length N vectors (or cell arrays if the data has different shapes). Notice that this can also store trees, as they're just graphs after all!

Storing these vectors as structs to pass them around easily, I'd have a struct representing the arcs:
arcs.tails = ...
arcs.heads = ...
arcs.costs = ...
(etc etc)
And another representing the nodes if necessary:
nodes.names = ...