Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #3924

Re: array index out of range

From Ethan A Merritt <EAMerritt@gmail.com>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: array index out of range
Date 2018-03-21 09:12 -0700
Organization A noiseless patient Spider
Message-ID <p8u08n$poh$1@dont-email.me> (permalink)
References <27a5038a-c936-479d-92e8-5e34a19a27e5@googlegroups.com>

Show all headers | View raw


olivier.gillia@gmail.com wrote:

> Hello there,
> 
> can somebody explain me this ?
> 
> Hereafter, with 08 and 09, there is a problem :
> 
> gnuplot> array nom_var[40]
> gnuplot>
> gnuplot> nom_var[01]='Date [01]'
> gnuplot> nom_var[02]='P    [02]'
> gnuplot> nom_var[03]='T403 [03]'
> gnuplot> nom_var[04]='T404 [04]'
> gnuplot> nom_var[05]='M    [05]'
> gnuplot> nom_var[06]='666_A[06]'
> gnuplot> nom_var[07]='668_C[07]'
> gnuplot> nom_var[08]='667_B[08]'
>                   ^
>          array index out of range

"08" would be an octal number because it begins with a "0",
but 8 is not a legal character in octal numbers.  
So "08" evaluates to NaN (not a number), which is not a 
valid array index.
I agree that the error message could be clearer.
A simpler assignment produces a clearer message:

gnuplot> N = 08 
              ^
         unexpected or unrecognized token: 8


Ethan

> 
> gnuplot> nom_var[09]='852_G[09]'
>                   ^
>          array index out of range
> 
> gnuplot> nom_var[10]='851_F[10]'
> gnuplot> nom_var[11]='850_E[11]'
> gnuplot> nom_var[12]='849_D[12]'
> gnuplot> nom_var[13]='848_G[13]'
> gnuplot> nom_var[14]='847_F[14]'
> gnuplot> nom_var[15]='846_E[15]'
> gnuplot> nom_var[16]='845_D[16]'
> gnuplot> nom_var[17]='844_G[17]'
> gnuplot> nom_var[18]='843_F[18]'
> gnuplot> nom_var[19]='842_E[19]'
> gnuplot> nom_var[20]='841_D[20]'
> gnuplot> nom_var[21]='666_A_cor[21]'
> gnuplot> nom_var[22]='668_C_cor[22]'
> gnuplot> nom_var[23]='667_B_cor[23]'
> gnuplot> nom_var[24]='852_G_cor[24]'
> gnuplot> nom_var[25]='851_F_cor[25]'
> gnuplot> nom_var[26]='850_E_cor[26]'
> gnuplot> nom_var[27]='849_D_cor[27]'
> gnuplot> nom_var[28]='848_G_cor[28]'
> gnuplot> nom_var[29]='847_F_cor[29]'
> gnuplot> nom_var[30]='846_E_cor[30]'
> gnuplot> nom_var[31]='845_D_cor[31]'
> gnuplot> nom_var[32]='844_G_cor[32]'
> gnuplot> nom_var[33]='843_F_cor[33]'
> gnuplot> nom_var[34]='842_E_cor[34]'
> gnuplot> nom_var[35]='841_D_cor[35]'
> 
> Hereafter, with "8" and "9", there is no problem !!!
> 
> gnuplot> array nom_var[40]
> gnuplot>
> gnuplot> nom_var[01]='Date [01]'
> gnuplot> nom_var[02]='P    [02]'
> gnuplot> nom_var[03]='T403 [03]'
> gnuplot> nom_var[04]='T404 [04]'
> gnuplot> nom_var[05]='M    [05]'
> gnuplot> nom_var[06]='666_A[06]'
> gnuplot> nom_var[07]='668_C[07]'
> gnuplot> nom_var[8]='667_B[08]'
> gnuplot> nom_var[9]='852_G[09]'
> gnuplot> nom_var[10]='851_F[10]'
> gnuplot> nom_var[11]='850_E[11]'
> gnuplot> nom_var[12]='849_D[12]'
> gnuplot> nom_var[13]='848_G[13]'
> gnuplot> nom_var[14]='847_F[14]'
> gnuplot> nom_var[15]='846_E[15]'
> gnuplot> nom_var[16]='845_D[16]'
> gnuplot> nom_var[17]='844_G[17]'
> gnuplot> nom_var[18]='843_F[18]'
> gnuplot> nom_var[19]='842_E[19]'
> gnuplot> nom_var[20]='841_D[20]'
> gnuplot> nom_var[21]='666_A_cor[21]'
> gnuplot> nom_var[22]='668_C_cor[22]'
> gnuplot> nom_var[23]='667_B_cor[23]'
> gnuplot> nom_var[24]='852_G_cor[24]'
> gnuplot> nom_var[25]='851_F_cor[25]'
> gnuplot> nom_var[26]='850_E_cor[26]'
> gnuplot> nom_var[27]='849_D_cor[27]'
> gnuplot> nom_var[28]='848_G_cor[28]'
> gnuplot> nom_var[29]='847_F_cor[29]'
> gnuplot> nom_var[30]='846_E_cor[30]'
> gnuplot> nom_var[31]='845_D_cor[31]'
> gnuplot> nom_var[32]='844_G_cor[32]'
> gnuplot> nom_var[33]='843_F_cor[33]'
> gnuplot> nom_var[34]='842_E_cor[34]'
> gnuplot> nom_var[35]='841_D_cor[35]'
> 
> Weird !!
> 
> Olivier

Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Find similar


Thread

array index out of range olivier.gillia@gmail.com - 2018-03-21 08:24 -0700
  Re: array index out of range Ethan A Merritt <EAMerritt@gmail.com> - 2018-03-21 09:12 -0700

csiph-web