[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Array subscript question
- Subject: Array subscript question
- From: bowman(at)null.edu (Kenneth P. Bowman)
- Date: Thu, 02 Mar 2000 16:11:24 -0600
- Newsgroups: comp.lang.idl-pvwave
- Organization: Texas A&M University
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:18751
Can someone explain this behavior to me? I can't find anything in the
documentation that states that repeated subscripts are handled
differently.
IDL> a = FINDGEN(5)
IDL> i = [1, 2, 3]
IDL> a[i] = a[i] + 10.0
IDL> PRINT, a
0.00000 11.0000 12.0000 13.0000 4.00000
This is the behavior I expect.
IDL> a = FINDGEN(5)
IDL> i = [2, 2, 2]
IDL> a[i] = a[i] + 10.0
IDL> PRINT, a
0.00000 1.00000 12.0000 3.00000 4.00000
Why does it only do the operation *once* when
IDL> HELP, a[i]
<Expression> FLOAT = Array[3]
IDL> a = FINDGEN(5)
IDL> i = [2, 2, 2]
IDL> a[i] = a[i] + [10.0, 10.0, 10.0]
IDL> PRINT, a
0.00000 1.00000 12.0000 3.00000 4.00000
Even this doesn't help.
Ken
--
Dr. Kenneth P. Bowman, Professor 409-862-4060
Department of Meteorology 409-862-4466 fax
Texas A&M University bowmanATcsrp.tamu.edu
College Station, TX 77843-3150 Replace AT with @