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: 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 ]

Posts: 12
Registered: 6/18/12
Indexing Problem
Posted: Jun 25, 2012 1:56 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello all,

I have a matrix 'all_counts' (29 by 8 array containing data, and some NaNs). I'm trying to graph certain parts. I'm using (I believe) logicals to do this.

I've defined:

% define location vector, to be used for cuts
src_loc = [ 1 1 2 2 3 1 1 3 2 1 2 1 3 3 1 3 1 1 1 1 3 1 1 3 1 3 1 2 2 ]; % (29 entries)
% Define actual positions

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!)
all_counts(SW,:) --- this gives all data from the Southwest source position (which is what I want)

...but when I try:
I get:
Index exceeds matrix dimensions.

What is going on here? I've tried 'clear all' and re-importing my 'all_counts' as well as the position definintion for SW, NW and NE. I really only get this error with the NW position (no matter which column I try to pick out) which is unlike my other positions calls (SW, NE)... how can I fix this?

Thank you for any help. If I've been unclear please just tell me how to clarify!!!


Date Subject Author
Read Indexing Problem
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]

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