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

Posts: 11
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
SW=src_loc==1;
NW=src_loc==2;
NE=src_loc==3;

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:
all_counts(NW,:)
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!!!

-Michael



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.