The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: 'index exceeds matrix dimensions' using text function with bar

Replies: 7   Last Post: Jan 31, 2013 10:21 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 9,850
Registered: 6/7/07
Re: 'index exceeds matrix dimensions' using text function with bar
Posted: Jan 31, 2013 10:21 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 1/30/2013 1:30 PM, dpb wrote:

> >> stats={[A' B]}
> stats =
> [5x3 double]

> >> y=cell2mat(stats(:,[2 3]));
> Index exceeds matrix dimensions.

> The problem is you can't subreference the array contents from the cell
> that way because the dimensions refer to the cell _array_ dimensions,
> not those of the data _in_ the cell.


And, BTW, what you're looking for is handled by 'multi-level
addressing'--you can do w/o the cell2mat() and access the data directly
by writing

y=stats{1}(:,[2 3]);

Note the curlies are on the cell to dereference, then the normal parens
around the content to select them elements.

There's a whole section in the doc on referencing cell contents directly...


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.