Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

Topic: Indexing Problem
Replies: 1   Last Post: Jun 25, 2012 2:07 PM

Advanced Search

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

Posts: 4,994
Registered: 11/28/09
Re: Indexing Problem
Posted: Jun 25, 2012 2:07 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Michael " <mabowles@syr.edu> wrote in message <jsa8nn$3qm$1@newscl01ah.mathworks.com>...
>
> Which all work properly when I ask MATLAB what they are.. (e.g. SW = row vector of 1's and 0's, and likewise for NW and NE). Here's the messed up part... I can try
>
> all_counts(1,:) --- this gives a 29-by-1 column of data (good!)

===============

I think you really meant to write all_counts(:,1). What you've written would have extracted a 1x8 row.



> all_counts(SW,:) --- this gives all data from the Southwest source position (which is what I want)
>
> ...but when I try:
> all_counts(NW,:)
> I get:
> Index exceeds matrix dimensions.
>
> What is going on here?

=====================

Works fine for me

>> all_counts=rand(29,8); all_counts(NW,:)

ans =

0.2217 0.7962 0.8865 0.3909 0.3015 0.5830 0.0688 0.6718
0.1174 0.0987 0.0287 0.8314 0.7011 0.2518 0.3196 0.6951
0.0855 0.7212 0.5005 0.4168 0.1781 0.9827 0.7184 0.8444
0.8010 0.6538 0.0596 0.6280 0.9991 0.3439 0.5313 0.7805
0.9880 0.8055 0.8253 0.5479 0.1206 0.6959 0.9577 0.4735
0.0377 0.5767 0.0835 0.9427 0.5895 0.6999 0.2407 0.1527


I would double-check the size of all_counts or NW. If this is happening inside a function, use DBSTOP to halt execution where the error is occuring. Check the dimensions of everything at that moment.


Date Subject Author
6/25/12
Read Indexing Problem
Michael
6/25/12
Read Re: Indexing Problem
Matt J

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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.