Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Index exceeds matrix dimension

Subject: Index exceeds matrix dimension

From: Snow White

Date: 24 Mar, 2009 12:23:01

Message: 1 of 7

Hi,

I have got the following error although i was not getting this before

??? Index exceeds matrix dimensions.

Error in ==> refractive_index_estimation at 96
            mean_intensity=mean(intensity(x,y,:));
x=110 and y=110

Cna anyone help with this please?

Subject: Index exceeds matrix dimension

From: Gavrilo Bozovic

Date: 24 Mar, 2009 12:29:01

Message: 2 of 7

"Snow White" <gulesaman@gmail.com> wrote in message <gqajb5$h2r$1@fred.mathworks.com>...
> Hi,
>
> I have got the following error although i was not getting this before
>
> ??? Index exceeds matrix dimensions.
>
> Error in ==> refractive_index_estimation at 96
> mean_intensity=mean(intensity(x,y,:));
> x=110 and y=110
>
> Cna anyone help with this please?

"index exceeds matrix dimensions" occurs, by a wild turn of events, when your index exceeds the dimensions of your matrix...

which means that intensity(110,110,:) does not exist.

Subject: Index exceeds matrix dimension

From: us

Date: 24 Mar, 2009 12:30:19

Message: 3 of 7

"Snow White"
> I have got the following error although i was not getting this before
> ??? Index exceeds matrix dimensions.
> Error in ==> refractive_index_estimation at 96
> mean_intensity=mean(intensity(x,y,:));
> x=110 and y=110
> Cna anyone help with this please...

you've been told several times now how to proceed in situation like these...
please, peruse your old OPs again...
in particular, look at the
     dbstop if error;
approach...

us

Subject: Index exceeds matrix dimension

From: Snow White

Date: 24 Mar, 2009 12:50:26

Message: 4 of 7

i know.. i know how to debug and where the error is i need a solution for this!!! not how to debug. thank u for that option:)

"us " <us@neurol.unizh.ch> wrote in message <gqajor$ftf$1@fred.mathworks.com>...
> "Snow White"
> > I have got the following error although i was not getting this before
> > ??? Index exceeds matrix dimensions.
> > Error in ==> refractive_index_estimation at 96
> > mean_intensity=mean(intensity(x,y,:));
> > x=110 and y=110
> > Cna anyone help with this please...
>
> you've been told several times now how to proceed in situation like these...
> please, peruse your old OPs again...
> in particular, look at the
> dbstop if error;
> approach...
>
> us

Subject: Index exceeds matrix dimension

From: Steven Lord

Date: 24 Mar, 2009 13:16:52

Message: 5 of 7


"Snow White" <gulesaman@gmail.com> wrote in message
news:gqakui$6eo$1@fred.mathworks.com...
>i know.. i know how to debug and where the error is i need a solution for
>this!!! not how to debug. thank u for that option:)
>
> "us " <us@neurol.unizh.ch> wrote in message
> <gqajor$ftf$1@fred.mathworks.com>...
>> "Snow White"
>> > I have got the following error although i was not getting this before
>> > ??? Index exceeds matrix dimensions.
>> > Error in ==> refractive_index_estimation at 96
>> > mean_intensity=mean(intensity(x,y,:));
>> > x=110 and y=110
>> > Cna anyone help with this please...
>>
>> you've been told several times now how to proceed in situation like
>> these...
>> please, peruse your old OPs again...
>> in particular, look at the
>> dbstop if error;
>> approach...
>>
>> us

If the problem is that intensity has fewer than x rows or fewer than y
columns, then the solution is to make intensity have at least x rows and y
columns by changing one or more of intensity, x, or y. How you accomplish
this task depends on your code and the problem you're solving -- it could be
that you cannot change x or y, and must change intensity; alternately, your
problem could require intensity to stay fixed, and you will have to change x
and y.

If the problem is that mean is a variable at this point in the code and
intensity(x, y, :) contains values greater than the length of that variable,
you need to modify mean and/or intensity(x, y, :) and/or you need to rename
the mean variable (if your intention is to call the MEAN function.) Again,
how you resolve the problem depends on your code and the problem you're
solving.

In any case, I don't think there's anyone on this newsgroup who can tell
you, step-by-step, how to solve this error, as what it means by "solve this
error" depends on information that only you know.

--
Steve Lord
slord@mathworks.com

Subject: Index exceeds matrix dimension

From: Snow White

Date: 24 Mar, 2009 13:42:00

Message: 6 of 7

i can not change x,y as it gives me the location and hence the intensity value of the image pixel.. mean is the matlab function...so i want to take the mean of the intensities and then store in the variable mean_intensity...

"Steven Lord" <slord@mathworks.com> wrote in message <gqamfh$kc2$1@fred.mathworks.com>...
>
> "Snow White" <gulesaman@gmail.com> wrote in message
> news:gqakui$6eo$1@fred.mathworks.com...
> >i know.. i know how to debug and where the error is i need a solution for
> >this!!! not how to debug. thank u for that option:)
> >
> > "us " <us@neurol.unizh.ch> wrote in message
> > <gqajor$ftf$1@fred.mathworks.com>...
> >> "Snow White"
> >> > I have got the following error although i was not getting this before
> >> > ??? Index exceeds matrix dimensions.
> >> > Error in ==> refractive_index_estimation at 96
> >> > mean_intensity=mean(intensity(x,y,:));
> >> > x=110 and y=110
> >> > Cna anyone help with this please...
> >>
> >> you've been told several times now how to proceed in situation like
> >> these...
> >> please, peruse your old OPs again...
> >> in particular, look at the
> >> dbstop if error;
> >> approach...
> >>
> >> us
>
> If the problem is that intensity has fewer than x rows or fewer than y
> columns, then the solution is to make intensity have at least x rows and y
> columns by changing one or more of intensity, x, or y. How you accomplish
> this task depends on your code and the problem you're solving -- it could be
> that you cannot change x or y, and must change intensity; alternately, your
> problem could require intensity to stay fixed, and you will have to change x
> and y.
>
> If the problem is that mean is a variable at this point in the code and
> intensity(x, y, :) contains values greater than the length of that variable,
> you need to modify mean and/or intensity(x, y, :) and/or you need to rename
> the mean variable (if your intention is to call the MEAN function.) Again,
> how you resolve the problem depends on your code and the problem you're
> solving.
>
> In any case, I don't think there's anyone on this newsgroup who can tell
> you, step-by-step, how to solve this error, as what it means by "solve this
> error" depends on information that only you know.
>
> --
> Steve Lord
> slord@mathworks.com
>

Subject: Index exceeds matrix dimension

From: Snow White

Date: 24 Mar, 2009 13:47:01

Message: 7 of 7

I have solved it thank u :)

"Snow White" <gulesaman@gmail.com> wrote in message <gqanv8$4us$1@fred.mathworks.com>...
> i can not change x,y as it gives me the location and hence the intensity value of the image pixel.. mean is the matlab function...so i want to take the mean of the intensities and then store in the variable mean_intensity...
>
> "Steven Lord" <slord@mathworks.com> wrote in message <gqamfh$kc2$1@fred.mathworks.com>...
> >
> > "Snow White" <gulesaman@gmail.com> wrote in message
> > news:gqakui$6eo$1@fred.mathworks.com...
> > >i know.. i know how to debug and where the error is i need a solution for
> > >this!!! not how to debug. thank u for that option:)
> > >
> > > "us " <us@neurol.unizh.ch> wrote in message
> > > <gqajor$ftf$1@fred.mathworks.com>...
> > >> "Snow White"
> > >> > I have got the following error although i was not getting this before
> > >> > ??? Index exceeds matrix dimensions.
> > >> > Error in ==> refractive_index_estimation at 96
> > >> > mean_intensity=mean(intensity(x,y,:));
> > >> > x=110 and y=110
> > >> > Cna anyone help with this please...
> > >>
> > >> you've been told several times now how to proceed in situation like
> > >> these...
> > >> please, peruse your old OPs again...
> > >> in particular, look at the
> > >> dbstop if error;
> > >> approach...
> > >>
> > >> us
> >
> > If the problem is that intensity has fewer than x rows or fewer than y
> > columns, then the solution is to make intensity have at least x rows and y
> > columns by changing one or more of intensity, x, or y. How you accomplish
> > this task depends on your code and the problem you're solving -- it could be
> > that you cannot change x or y, and must change intensity; alternately, your
> > problem could require intensity to stay fixed, and you will have to change x
> > and y.
> >
> > If the problem is that mean is a variable at this point in the code and
> > intensity(x, y, :) contains values greater than the length of that variable,
> > you need to modify mean and/or intensity(x, y, :) and/or you need to rename
> > the mean variable (if your intention is to call the MEAN function.) Again,
> > how you resolve the problem depends on your code and the problem you're
> > solving.
> >
> > In any case, I don't think there's anyone on this newsgroup who can tell
> > you, step-by-step, how to solve this error, as what it means by "solve this
> > error" depends on information that only you know.
> >
> > --
> > Steve Lord
> > slord@mathworks.com
> >

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us