当前位置:文档之家› 变量名有两个重要属性数据类型和组织结构数据类型指出属于数据

变量名有两个重要属性数据类型和组织结构数据类型指出属于数据

IDL中的变量类型变量名有两个重要属性:数据类型和组织结构。

数据类型指出属于数据类型中的哪一种。

在IDL中有14种基本数据类型。

在图表1中将看到每一种数据类型,每个类型创建的变量的字节大小,变量创建方式,数据类型之间强制转换的IDL函数名称。

除了数据类型外,一个变量有一个组织结构。

有效的组织结构有标量(例如单个数值)、矢量(真正的一维数组)、数组(最高可达8维)和IDL结构(能包含各种数据类型的变量和组织结构,结构中独立的组成部分称为字段)。

数据类型字节数创建变量数据类型函数字节型 1 Var=0BthisVar=Byte(variable)16位有符号整型2 Var=0thisVar=Fix(variable)32位有符号长整型4 Var=0LthisVar=Long(variable)64位有符号整型8 Var=0LLthisVar=Long64(variable)16位无符号整型2 Var=0UthisVar=UInt(variable)32位无符号长 4 Var=0UL thisVar=ULong(varia整型ble) 64位无符号整型8 Var=0ULLthisVar=Ulong64(variable)浮点型 4 Var=0.0thisVar=Float(variable)双精度浮点型8 Var=0.0DthisVar=Double(variable)复数8Var=Complex(0.0,0.0) thisVar=Complex(variable)双精度复数16Var=Dcomplex(0.0D,0.0D) thisVar=DComplex(variable)字符串0-32767 Var=’’或Var=””thisVar=String(variable)指针 4 Var=Ptr_New() None对象 4 Var=Obj_New() None表1:IDL中的14种基本数据类型。

表中显示了每种数据类型的字节数,创建变量的方法,用语数据类型之间强制转换的IDL函数数据类型初始化函数产生索引值的函数字节型BytArr BIndGen 16位有符号整型IntArr IndGen32位有符号长整型LonArr LIndGen64位有符号整型Lon64Arr L64IndGen16位无符号整型UIntArr UIndGen32位无符号长整型ULonArr ULIndGen64位无符号整型ULon64Arr UL64IndGen 浮点型FltArr FIndGen 双精度浮点型DblArr DIndGen 复数ComplexArr CIndGen 双精度复数DComplexArr DCIndGen字符串StrArr SIndGen指针PtrArr None对象ObjArr None表2:IDL函数可以创建矢量和多维数组,并将其每个元素初始为0或为它们本身的索引号码。

IDL中的关系运算符:EQ---------------相等NE---------------不相等LE---------------小于等于GE---------------大于等于LT----------------小于GT----------------大于IDL中常用函数:FSTAT(lun)-----------------------------查看文件信息STRCTURE FILE_LINES( )-------------------------统计文档中数据的行数lines FUNCTION file_lines, filenameOPENR, unit, filename, /GET_LUNstr = ''count = 0llWHILE ~ EOF(unit) DO BEGINREADF, unit, strcount = count + 1ENDWHILEFREE_LUN, unitRETURN, countENDFILE_INFO( )--------------------------文件信息DIALOG_PICKFILE( )--------------选择文件或文件夹FIEL_SEARCH( )---------------------查找文件PRINT-----------------------------------打印READF----------------------------------打开文件读READW---------------------------------打开文件写STRTRIM( STR,0/1/2)----------------去除字符串两头的空格STRMID( )------------------------------读取字符串中指定的一段字符REFORM( )-----------------------------设定数组格式GET_LUN------------------------------获取逻辑设备号FREE_LUN-----------------------------释放逻辑设备号POINT_LUN,lun,0---------------------重新设定LUN位置STRSPLIT( )----------------------------到指定字符CELL( N )-------------------------------反回大于等于N的最小整数FLOOR( N )-----------------------------反回小于等于N 的最大整数ROUND( N )----------------------------返回最接近N的整数SQRT( N )-------------------------------计算N的平方根EXP ( N)------------------------------计算以e为底,以N为指数的函数值ALOG( N)------------------------------计算N的自然对数值ALOG10(N)----------------------------计算N的常用对数SYSTIME( )----------------------------以24个字符的串形式返回当前系统时间STRCMP( a,b,N,/FOLD_CASE)----比较字符串a和b的前N个字符是否相等(/FOLD_CASE忽略大小写)STRCOMPRESS( ARR )------------去除字符串中单词间多于一个的空格。

关键字[,REMOVE_ALL]指去除全部空格IDL中的调试命令:Debugging.CONTINUE - Continues execution of a stopped program..SKIP - Skips over the next n statements and then single steps..STEP - Executes one or n statements from the current position..STEPOVER - Executes a single statement if the statement doesn't call aroutine..TRACE - Similar to .CONTINUE, but displays each line of code before execution.BREAKPOINT - Sets and clears breakpoints for debugging. SHMDEBUG - Print debugging information when a variable loses reference to an underlying shared memory segment.STOP - Stops the execution of a running program or batch file.IDL中的字符串处理函数:String ProcessingFILE_BASENAME - Returns the basename of a file path.FILE_DIRNAME - Returns the dirname of a file path.STRCMP - Compares two strings.STRCOMPRESS - Removes whitespace from a string.STREGEX - Performs regular expression matching.STRING - Converts arguments to string type.STRJOIN - Collapses a string scalar or array into merged strings.(连接字符串)STRLEN - Returns the length of a string.STRLOWCASE - Converts a string to lower case. (转换为小写字母)STRMATCH - Compares search string against input string expression. STRMID - Extracts a substring(子字符串)from a string.STRPOS - Finds first occurrence of a substring within a string. STRPUT - Inserts the contents of one string into another.STRSPLIT- Splits its input string argument into separate substrings, according to the specified pattern.STRTRIM - Removes leading and/or trailing blanks from string. STRUPCASE - Converts a string to upper case.(将字符转换为大写)。

相关主题