STRING(/PRINT) bug? [message #724] |
Wed, 04 November 1992 15:57 |
deutsch
Messages: 19 Registered: February 1992
|
Junior Member |
|
|
Is this a bug or just the way it is:
IDL> print,strtrim(string('366,2',/print),2)
366,2
IDL> print,strtrim(string('(366 2)'),2)
(366 2)
IDL> print,strtrim(string('(366,2)',/print),2)
% "(366,2)"
% ^
% Repetition count not allowed with ",".
% Execution halted at STARCHCK2 </home/idlv2/deutsch/img/starchck2.pro( 55)>
(STRING).
% Called from IMGCLEAN </home/idlv2/deutsch/img/imgclean.pro( 163)>.
% Called from $MAIN$ .
It seems that IDL is interpreting my string as a format, although there is
no other argument which could be the the object of the format. This only
happens when the PRINT keyword is set.
Using the regular prints statement, IDL seems to know the difference:
IDL> print,'(366,2)'
(366,2)
At the moment, I'm working around this by first checking the data type of
the argument to string: if it's a string, I turn PRINT off, if it's anything
else I use /PRINT. This seems a little unnecessary...
Is this problem a bug left over from before the Keyword era, or the way it's
supposed to be?
Note to the users of the Astronomy Library, this affects the use of the
STRN and VECT functions...
IDL> print,strn(vect([100,200]),length=20)
will not work....
Eric Deutsch
University of Washington Astronomy
|
|
|