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

Home » Public Forums » archive » Re: XY position of subscripts
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: XY position of subscripts [message #80181 is a reply to message #80180] Fri, 11 May 2012 09:02 Go to previous messageGo to previous message
KH is currently offline  KH
Messages: 9
Registered: August 2011
Junior Member
On May 11, 11:36 am, Mats Löfdahl <mats.lofd...@gmail.com> wrote:
> Den fredagen den 11:e maj 2012 kl. 17:14:27 UTC+2 skrev KH:
>
>> Hello,
>> I have a quick question I was hoping to get some help with.
>
>> Assuming you have a 2D array and then use WHERE to find specific
>> subscripts in the array, how can you convert those subscripts into X
>> and Y coordinates?
>
>> I feel like this is something I should know how to do, but I am
>> drawing a blank right now.
>> Thanks,
>> Kim
>
> Here's an example:
>
> IDL> Ni=10
> IDL> Nj=20
> IDL> A=bytarr(Ni,Nj)
> IDL> A[4,7]=1
> IDL> indx=where(A eq 1)
> IDL> print,A[indx mod Ni, indx / Ni]
>    1

Thanks for the reply, but what I am looking for are the X and Y
positions of where the array equals 1. So in your example, how would
I get X=4 and Y=7 from the subscripts generated by the WHERE command?
Kim
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: scalar system variable as single element array
Next Topic: cgplot and the disappearing white axis

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

Current Time: Sat Oct 11 00:27:52 PDT 2025

Total time taken to generate the page: 0.79825 seconds