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

Home » Public Forums » archive » help with IF statement
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: help with IF statement [message #90062 is a reply to message #90059] Wed, 21 January 2015 16:07 Go to previous messageGo to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
If I am reading it right, your code seems to match your description. Someone here used to say that this usually means there is something wrong with your assumptions about your arrays.

I would suggest checking the types, dimensions and values of some of the relevant expressions in your code, such as barray, other, dataarray[*,i,j], array[i,j], new_data[*,j,k] and mean[j,k]

By the way, are the expressions with new_data and mean supposed to be indexed by j and k? Not j and i? There is nothing in this code fragment setting the value of k. If it is really k, check that j and k were not swapped.

Paulo

On Wednesday, January 21, 2015 at 3:26:59 PM UTC-2, g.na...@gmail.com wrote:
> Hi
>
> I need some help with an IF statement because I suspect that it's not doing what I really wish to do.
>
> I have a 3D array [120,200,200] which contains my data. Then I am using this matrix to create another matrix. My code looks like this
>
> DataArray ; contains the 3D data
> Mean = total(DataArray[0:4,*,*],1)/5.
>
> for i = 0, 199 do begin
> for j = 0, 199 do begin
> Barray = DataArray[*,i,j] - Array[i,j]
> IF (TOTAL(Barray LT 0)) GT 0 THEN NEW_DATA[*,j,k] = Mean[j,k] $
> ELSE NEW_DATA[*,j,k] = Mean[j,k] + OTHER
> endfor
> endfor
>
> What I wanted to achieve with the above is that if an entry in the Barray has a negative value then the New_Data it's equals the mean otherwise NEW_DATA= Mean+ OTHER.
> My data are images and when I display the images after that I found out that in places that there are not negative numbers the new_data array equals the mean only not the whole expression (Mean[j,k] + OTHER). Why this happened? It supposed to use the mean only when there are negatives.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Map method bug?
Next Topic: check for infinity

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

Current Time: Thu Oct 09 18:59:20 PDT 2025

Total time taken to generate the page: 1.52522 seconds