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

Home » Public Forums » archive » Re: How to extract a scalar from a vector?
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: How to extract a scalar from a vector? [message #74161 is a reply to message #74160] Tue, 04 January 2011 15:43 Go to previous messageGo to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
> 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.

I do not know what you mean by "thinks they are" 1-element arrays.
They *are* 1-element arrays. Any time an array indexed by an array (in
this case, the result of where), the result is an array, even if it
only has 1 element.

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

You are right that this is the problem, since the product of arrays of
different sizes has the size of the smaller of the two, in this case,
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:

Use just one element of sel_cal_data (the one element is a scalar),
instead of the whole sel_cal_data array:

cal_data[sel_cal_data[0],3]
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Colorimetric map in IDL
Next Topic: Using color tables in function graphics

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

Current Time: Wed Oct 08 11:53:12 PDT 2025

Total time taken to generate the page: 0.00648 seconds