numeric value – search for the index of a specific element in a list

I have searched everywhere to find an answer to this question and I have not found anything!

I have a data file containing two columns, one with nanometer wavelengths (some with decimal digits, others simply with a decimal point) and the other one with a number of decimal points. other with spectral irradiance values.

I'm trying to create a new array that takes as first column all the wavelengths and in the second column I divide the spectral values ​​by the energy of the photons to get the photon flux. However, in this new table, I wish to stop at a certain index i, where the wavelength corresponds to a specific photonic energy that I have calculated. That's the code I use. It works.

Here is a small part of the data table:

``````{280., 280.5, 281., 281.5, 282., 282.5, 283., 283.5, 284., 284.5,

SSpecUsed = Drop[Table[{SSpecWavelength[[i]], SSpecIntensity[[i]]/ Eph[SSpecWavelength[SSpecWavelength[SSpecWavelength[SSpecWavelength[[i]]]*Index[En, G, Si]* q /. numval}, {i, 0, 949, 1}], 1];
``````

My problem is that I have manually found the index (949) at which the wavelength is 1107. nm. In a subsequent exercise, I will need to integrate these data with different indices (for example, integrating up to the 2000 wavelength and in the next stage until 1999). I've therefore tried to replace the 949 value with:

``````Position[SSpecWavelength, Subscript[[Lambda], G][Eg_]]/.numval
``````

So, basically, I try to use Position to find the index at which the item in the list equals the length of the wave that I calculate according to. a value of energy. When I cast it, I get empty braces. I've even tried this:

``````Position[SSpecWavelength, 1107.]
``````

and I always get empty braces. I've checked and I know for a fact that the element at index 949 equals 1107. So why does not it return me the index?

Is there another way (better / simpler) to achieve what I want?

Thanks in advance, hope the problem is clear!

Posted on