1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: IDL keywords

  1. Nov 23, 2007 #1
    1. The problem statement, all variables and given/known data
    I've created a function inside IDL and I want to be able to specify the binsize.
    That is, I want to have:

    result = myfunction(array, keyword)

    Whenever I add the keyword in the brackets there it says:

    "Keyword parameters not allowed in call."

    2. Relevant code

    FUNCTION histimage, array, binsize=x

    If KEYWORD_SET(x) then $

    count = uintarr(256/x)
    array = array*(1/x)

    *end if else begin
    count = uintarr(256)

    for j = 0,255 do begin
    for k = 0,255 do begin
    count(array(j,K)) = count(array(j,k)) + 1

    Return, count


    Histimage is the name of my function and binsize is the keyword. The point in the code where there is a * shows where I get a compile error as well. I can't see why I get this error and was hoping that someone could tell me if I've used incorrect syntax.
  2. jcsd
  3. May 13, 2008 #2
    Hi, hope this isn't too late to be of help, I stumbled across this looking for help on keyword syntax.

    In IDL I think you need:

    if keyword_set(x) then blah
    if not keyword_set(x) then bleh

    I think that's why you're getting a compile error at "endif else begin", as it's not the correct syntax for the keyword_set function.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook