assigning integer and string value to same variable one by one [message #93009] |
Sat, 09 April 2016 04:26  |
Sapna Mishra
Messages: 66 Registered: December 2015
|
Member |
|
|
Pro tt
for i=0,25 do begin
Print,'By seeing mplot give obj_col:'
Read,obj_col
wait,1
if (STRMATCH(datatype(obj_col), 'INT', /FOLD_CASE) EQ 0) then i=i+1
print,i
endfor
return
end
IDL> .compile tt.pro
% Compiled module: TT.
IDL> tt
By seeing mplot give obj_col:
: 1
% Compiled module: DATATYPE.
0
By seeing mplot give obj_col:
: 'q'
% READ: Input conversion error. Unit: 0, File: <stdin>
% Execution halted at: TT 5 /home/cs/dN_dz/Ana/tt.pro
% $MAIN$
IDL>
Can't I give integer and string value to same variable if I want to jump on loop if the value of that input variable in a string??
Any way out?
|
|
|
Re: assigning integer and string value to same variable one by one [message #93010 is a reply to message #93009] |
Sat, 09 April 2016 04:27  |
Sapna Mishra
Messages: 66 Registered: December 2015
|
Member |
|
|
Pro tt
for i=0,25 do begin
Print,'By seeing mplot give obj_col:'
Read,obj_col
wait,1
if (STRMATCH(datatype(obj_col), 'STR', /FOLD_CASE) EQ 1) then i=i+1
print,i
endfor
return
end
IDL> .compile tt.pro
% Compiled module: TT.
IDL> tt
By seeing mplot give obj_col:
: 1
% Compiled module: DATATYPE.
0
By seeing mplot give obj_col:
: 'q'
% READ: Input conversion error. Unit: 0, File: <stdin>
% Execution halted at: TT 5 /home/cs/dN_dz/Ana/tt.pro
% $MAIN$
IDL>
Can't I give integer and string value to same variable if I want to jump on loop if the value of that input variable in a string??
Any way out?
|
|
|