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

Home » Public Forums » archive » Very basic IDL vector question
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: Very basic IDL vector question [message #93150 is a reply to message #93148] Tue, 03 May 2016 01:35 Go to previous messageGo to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Tuesday, May 3, 2016 at 7:27:53 AM UTC+1, kubota wrote:
> I am trying to understand the operation of an IDL program. There are several lines using vectors which I do not understand.
>
> The first line is:
>
> fc = call_function(fun,xc)
>
> Here, xc is a vector.
>
> Is fc a scalar or vector, being that xc is a vector?
> If fc is a scalar, which element of xc is being used for the function calculation?
> If fc is a vector, does that mean that the vector fc is filled with all the function evaluations of the x values in xc?
>
> Thanks for any assistance.

Hi,
the call_function() function calls a function called with the name of your string (I suppose) "fun" and passes xc as a parameter. The return value of the function will be put into fc.

Consider these two functions:

function testTotal, arr
return, total(arr)
end

function testDouble, arr
return, arr*2
end

If you now call:
fun = 'testTotal'
xc = findgen(10)
fc = call_function(fun,xc)

then you will get a single value (scalar) in fc equal to the total of xc (in this case 45.0).
If you call:

fun = 'testDouble'
xc = findgen(10)
fc = call_function(fun,xc)

Then in fc you get an array:
IDL> print, fc
0.000000 2.00000 4.00000 6.00000 8.00000 10.0000 12.0000 14.0000 16.0000 18.0000

I hope it helps.

Cheers,
Helder
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Help - IDL Basic Question
Next Topic: syntax for calling parent class _overloadPlus method

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

Current Time: Wed Oct 08 15:13:42 PDT 2025

Total time taken to generate the page: 0.00463 seconds