Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: Subscript indices are real integers but getting error saying they are not?

Subject: Subscript indices are real integers but getting error saying they are not?

From: Colm

Date: 31 Jul, 2007 15:20:36

Message: 1 of 6

Hi,

I have been scratching my head about this one and a look through the other posts hasn't helped so I thought someone might be able to help. I have an m-file in which I form a 4-d double array (11x11x12x26) of sea surface temps (sst) and I want to get the means along the 3rd dimension, so I have a line

avg_sst = mean(month_array,3)

which gave the error:

"Subscript indices must either be real positive integers or logicals"

so I tried using for loops and reshaping the array, etc but always got the same error.

Can anyone help?

Thanks,

Colm

Subject: Re: Subscript indices are real integers but getting error saying they are not?

From: us

Date: 31 Jul, 2007 15:28:20

Message: 2 of 6

Colm
<SNIP function-is-var evergreen...

one of the (likely) solutions

     x=1:5;
     clear mean;
     mean(x)

us

Subject: Re: Subscript indices are real integers but getting error saying they are not?

From: Colm

Date: 31 Jul, 2007 15:40:40

Message: 3 of 6

"us " <us@neurol.unizh.ch> wrote in message <f8nkek$ghn$1@fred.mathworks.com>...
> Colm
> <SNIP function-is-var evergreen...
>
> one of the (likely) solutions
>
> x=1:5;
> clear mean;
> mean(x)
>
> us

I'm sorry. I don't understand what you mean.

Subject: Re: Subscript indices are real integers but getting error saying they are not?

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 31 Jul, 2007 16:19:17

Message: 4 of 6

In article <f8nl5o$1be$1@fred.mathworks.com>,
Colm <c.oshea4@nuigalway.ie> wrote:
>"us " <us@neurol.unizh.ch> wrote in message <f8nkek$ghn$1@fred.mathworks.com>...
>> <SNIP function-is-var evergreen...

>> one of the (likely) solutions

>> x=1:5;
>> clear mean;
>> mean(x)

>I'm sorry. I don't understand what you mean.

He means that likely you have a variable named 'mean' that that
that is interfering with your use of the function named 'mean'.


--
  Is there any thing whereof it may be said, See, this is new? It hath
  been already of old time, which was before us. -- Ecclesiastes

Subject: Re: Subscript indices are real integers but getting error saying they are not?

From: us

Date: 31 Jul, 2007 16:25:07

Message: 5 of 6

Walter Roberson
<SNIP another definition of <evergreen>...
***
Is there any thing whereof it may be said, See, this is new? It hath been already of old time, which was before us. [Ecclesiastes]
***

> He means that likely you have a variable named 'mean' that is interfering with your use of the function named 'mean'...

thank you <walter> for clarification
:-)
us

Subject: Re: Subscript indices are real integers but getting error saying they are not?

From: Colm

Date: 01 Aug, 2007 11:34:36

Message: 6 of 6

"us " <us@neurol.unizh.ch> wrote in message <f8nnp3$ljr$1@fred.mathworks.com>...
> Walter Roberson
> <SNIP another definition of <evergreen>...
> ***
> Is there any thing whereof it may be said, See, this is new? It hath been already of old time, which was before us. [Ecclesiastes]
> ***
>
> > He means that likely you have a variable named 'mean' that is interfering with your use of the function named 'mean'...
>
> thank you <walter> for clarification
> :-)
> us

That was it. Thanks for your help. (I feel like an idiot for not picking that one up!)

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
evergreen us 30 Jan, 2008 20:27:28
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics