Using the Where Function in IDL to Search for a Specific Date in an Array

  • Thread starter conquertheworld5
  • Start date
  • Tags
    Function
In summary, the beginner programmer is asking if the where function can be used to search for a specific string in an array. They have a structure with two arrays, one for dates and one for data, and they want to retrieve all elements that correspond to a certain day. They attempted to use the where function but only received a -1 result. The language being used is IDL.
  • #1
conquertheworld5
22
0
Hey,beginner programmer with a simple question...
is there any way I can use the where function to search for a string in elements of an array?
I have a structure with two arrays, the first for the date (a string in the form of dd-mm-yyyy i.e. 11-07-2007) and the second has data. I want all the elements that correspond to a certain day.
what I tried to do:

a=where(b.a eq "11-07-2007")
then I expected to get all the spots in the array that had that date... all i got was -1 :-(
 
Technology news on Phys.org
  • #2
Can you mention which language you are using?

Mr V
 
  • #3
I think he's using IDL, based on the thread title.
 

1. What is the purpose of the "Idl - where" function?

The "Idl - where" function is used to find the indices of elements in an array that satisfy a given condition. It helps to identify specific data points within an array that meet certain criteria.

2. How do I use the "Idl - where" function?

To use the "Idl - where" function, you need to provide two arguments: the array you want to search through and the condition you want to check for. The function will then return an array containing the indices of elements that meet the condition.

3. Can I use multiple conditions with the "Idl - where" function?

Yes, you can use multiple conditions with the "Idl - where" function by using logical operators like AND (&) and OR (|). You can also use parentheses to group conditions together.

4. What types of data can I use with the "Idl - where" function?

The "Idl - where" function can be used with any type of data, including numeric, string, and boolean values. It can also be used with arrays of any dimension.

5. Are there any alternatives to the "Idl - where" function?

Yes, there are other functions in the IDL programming language that serve a similar purpose to the "Idl - where" function, such as "Idl - where2" and "Idl - wherei". These functions may have slight variations in their syntax or capabilities, so it is important to read the documentation carefully to determine which one best suits your needs.

Similar threads

  • Programming and Computer Science
Replies
2
Views
600
  • Programming and Computer Science
Replies
20
Views
1K
Replies
3
Views
754
  • Programming and Computer Science
Replies
5
Views
2K
  • Programming and Computer Science
Replies
1
Views
4K
  • Programming and Computer Science
Replies
5
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Programming and Computer Science
Replies
5
Views
5K
  • Programming and Computer Science
Replies
1
Views
2K
  • Programming and Computer Science
Replies
7
Views
5K
Back
Top