Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: Matrix indices Date: Mon, 30 Jan 2012 23:52:10 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 27 Message-ID: <jg7afa$krk$1@newscl01ah.mathworks.com> References: <7935790b-4cbe-4387-b8c7-7f6266349bc3@rk3g2000pbb.googlegroups.com> <96cf8ecc-8c37-44c3-ad60-d5b958c10f24@3g2000pbd.googlegroups.com> Reply-To: <HIDDEN> NNTP-Posting-Host: www-06-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: newscl01ah.mathworks.com 1327967530 21364 172.30.248.38 (30 Jan 2012 23:52:10 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Mon, 30 Jan 2012 23:52:10 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1187260 Xref: news.mathworks.com comp.soft-sys.matlab:756215 rahill <raheleh.baharloo@gmail.com> wrote in message <96cf8ecc-8c37-44c3-ad60-d5b958c10f24@3g2000pbd.googlegroups.com>... > > 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. > > .......... > "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. - - - - - - - - - With the values you quote your 'AllColumns' indices array is of size up to a three dimensional 45000*13*20 = 11700000 elements and its values range from 1 to 3600000. Matlab's 'double' numbers are fully capable of handling integers of this magnitude without error, but in the form of indices I am not sure how well they would be dealt with. After the sig = sig(AllColumns); step the 'sig' array would then have 11700000 elements, which is a very large array and somewhere in matlab's processing this might require linear index values that large to access all of them. However, I would think that if there were trouble of this kind, it would be consistent for given values of 'LL', 'Rchunk', and 'n_cut'. I can't see offhand how it could depend on the initial contents of 'sig'. If 'sig' were too small to begin with, you should receive a different error message. What is it that varies between your different runs as far as this part of your code is concerned? You spoke of getting error indications only once in many trials. Is there any consistent pattern in the circumstances that prevail when the error occurs? It is possible this problem should be reported to the support people of Mathworks but I think they would need to see an example that they could consistently reproduce. Once in a thousand times would probably not be greeted with enthusiasm. By the way, you should make sure that your error message actually refers to the above 'sig' step rather than another step, to make sure that it is caused by something related to 'AllColumns' or 'sig'. Have you by any chance defined a function with this same name: 'sig'? That could give you all sorts of trouble, perhaps this particular error message, and is something always to be avoided. Roger Stafford