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

Home » Public Forums » archive » How to extract a scalar from a vector?
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 extract a scalar from a vector? [message #74163] Tue, 04 January 2011 15:13
Balt is currently offline  Balt
Messages: 16
Registered: May 2010
Junior Member
Hi,

I have an array with doubles (calibration factors for some data):

CAL_DATA DOUBLE = Array[24, 4]

I have a channel and unit number which is used to extract the proper
gain and offset from the cal_data array. So to obtain gain a and
offset b from this array, I extract it as follows:

For channel=1, unit=3:

sel_cal_data = WHERE(cal_data[*,0] EQ 3 AND cal_data[*,1] EQ 1, count)

Which works fine, as this illustrates:

IDL> PRINT, "A:", cal_data[sel_cal_data,2], "B:",
cal_data[sel_cal_data,3]
A: 96.859805
B:
-304.81185
IDL>

These are the values I want (verified manually).

Now for the problem: I now need to convert the voltages in the array
u3_C165 into temperatures, again, simple:

u3_T165 = cal_data[sel_cal_data,2] * u3_C165 - cal_data[sel_cal_data,
3]

So, u3_C165 contains 1570 measurements:
IDL> help,u3_C165
U3_C165 DOUBLE = Array[1570]

Now u3_T165 should contain 1570 datapoints of temperature. Except, it
doesn't! For some reason, this is what's in there now:

IDL> help,u3_T165
U3_T165 DOUBLE = Array[1]
IDL>

I think the problem is that IDL thinks that cal_data[sel_cal_data,2]
and cal_data[sel_cal_data,3] are vectors of dimension 1, when they
should be scalars.

See this:
IDL> help,cal_data[sel_cal_data,
3]
<Expression> DOUBLE = Array[1]

How on earth can I make cal_data[sel_cal_data,2] and
cal_data[sel_cal_data,3] into a scalar? I tried this:

IDL> x = DOUBLE(cal_data[sel_cal_data,3])
IDL> help,x
X DOUBLE = Array[1]

obviously to no avail.

Any help greatly appreciated!

Thanks

- Balt
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: TrueType fonts question
Next Topic: Re: More efficient method of appending to arrays when using pointers?

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

Current Time: Wed Oct 08 11:43:23 PDT 2025

Total time taken to generate the page: 0.00470 seconds