|
On Jan 29, 10:57 am, "Roger Stafford"
<ellieandrogerxy...@mindspring.com.invalid> wrote:
> rahill<raheleh.bahar...@gmail.com> wrote in message <7935790b-4cbe-4387-b8c7-7f6266349...@rk3g2000pbb.googlegroups.com>...
> > My function can work correctly many times (for example 1000 times)
> > but suddenly it makes this error “Subscript Indices Must Be Real
> > Positive Integers or Logicals”
> > And running stops.
>
> - - - - - - - - - -
> You haven't said how large "n_cut" and "RChunk" are. If the maximum value in 'AllColumns',
>
> 11+11250*(n_cut-1)+(RChunk-1)*180000 ,
>
> is excessively large and being used as an index, that could lead to all kinds of difficulties. As Pekka suggests, use your debug facility to study the situation when your error occurs.
>
> Note that matlab's addition, subtraction, and multiplication operations on integers are always exact unless the quantities involved exceed 2^53 which is about 9e15. (Your 'round' operation accomplishes nothing whatever - the results are already integers.) Beyond that limit, matlab's double floating point integers must be rounded to the nearest 53-bit representation. (For example, 2^53+1 will automatically be rounded down to 2^53, and 2^55+14 up to 2^55+16.) You should check that that never occurs in your calculations. Also I believe there is some kind of size limit imposed on array indices which you should be concerned about.
>
> Roger Stafford
Dear Roger
thanks for your attention
"n_cut" is 13, "Rchunk" vary between 1 to 20, and "ll" is 45000.
maybe the problem happens because of the large amount of my indices
matrix,I have test my function many times and I have saved all my
workspace after errors happend.but I dont know how can I understand
what is the problem, sometimes after stopping Matlab according to the
error I can do "sig = sig(AllColumns);" without any problem,while
Matlab has stopped running in the start of this line!! I dont know how
can i check such a large matrix. please help me.
thanks
Rahill
|