comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » how to deal with problem:Loop limit expression too large for loop variable type.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
how to deal with problem:Loop limit expression too large for loop variable type. [message #59652] Fri, 04 April 2008 05:08 Go to next message
Magic.Zhou is currently offline  Magic.Zhou
Messages: 16
Registered: April 2008
Junior Member
i just code a for function
for i=0, ArraySize do begin
if (Seg_Grey_Image[i] le 255) and (Seg_Grey_Image[i] ge 240) then
begin
Seg_Grey_Image[i]=255
endif
endfor
however, the error is :Loop limit expression too large for loop
variable type.
it seems this 'ArraySize' is too big. how can I deal with this
problem?
Thank you!
Re: how to deal with problem:Loop limit expression too large for loop variable type. [message #59708 is a reply to message #59652] Sun, 06 April 2008 05:19 Go to previous message
Magic.Zhou is currently offline  Magic.Zhou
Messages: 16
Registered: April 2008
Junior Member
Thank you very much!
Re: how to deal with problem:Loop limit expression too large for loop variable type. [message #59716 is a reply to message #59652] Sat, 05 April 2008 06:07 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
armand.jongen@gmail.com writes:

> On 5 apr, 08:13, Magic.Z...@gmail.com wrote:
>> OK, I get that, seem I always some details in programming. thank you!
>
> But you better use the WHERE function for problems like these:
>
> locs = WHERE((Seg_Grey_Image LE 255) AND (Seg_Grey_Image GE 240))
> Seg_Grey_Image[locs]=255
>
> Do not forget to also look at the minimum and maximum operator < and
>> , or the memory efficient variants <= and >= . They might give you
> more ideas to solve your problems.

And as long as you are paying all this money for the
self-improvement course, have a look at compile options
defint32 and strictarr. Those won't hurt you any, either. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: how to deal with problem:Loop limit expression too large for loop variable type. [message #59717 is a reply to message #59652] Sat, 05 April 2008 01:24 Go to previous message
armand.jongen is currently offline  armand.jongen
Messages: 1
Registered: April 2008
Junior Member
On 5 apr, 08:13, Magic.Z...@gmail.com wrote:
> OK, I get that, seem I always some details in programming. thank you!

But you better use the WHERE function for problems like these:

locs = WHERE((Seg_Grey_Image LE 255) AND (Seg_Grey_Image GE 240))
Seg_Grey_Image[locs]=255

Do not forget to also look at the minimum and maximum operator < and
> , or the memory efficient variants <= and >= . They might give you
more ideas to solve your problems.

Cheers,

-Armand
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How to change the 3D visual angel?
Next Topic: Extract elements from floating-point array

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:58:48 PDT 2025

Total time taken to generate the page: 0.00505 seconds