idl结果显示窗口如何缩小_使用IDL的12个小技巧

原文来自

michaelgallory

译文有不妥之处请大家指正。

tip

1

put

code

in

files.

your

choices

are

to

write

main-level

programs,

batch

files,

and normal procedures/functions. the bulk of your code should probably be in

procedures and functions, but there are certainly reasons to use both main-level

programs

and

batch

files.

main-level

programs

are

handy

for

setting

up

a

situation

and

allowing

you

to

enter

commands

accessing

the

variables

in

the

program

after

it

has

run.

batch

files

are

good

for

including

code

that

needs

to

be

typed

in

multiple

locations.

把代码存放在文件中。

你可以选择写主程序,

批处理文件和常见的过程或函数。

大量的代码

应该是包含在过程和函数中,

但是为什么要用主程序和批处理文件,

这肯定是有它的原因的。

主程序有利于环境的创建,

在程序运行后你还可以输入命令来访问它的变量。

批处理文件有

利于存储那些需要在多个位置键入的代码。

tip

2

place

your

main

routine

last

in

a

file

and

name

the

file

the

same

as

this

routine

plus

a

".pro"

extension.

alternatively,

you

could

put

each

routine

in

its

own

file

with the same name as the routine plus a ".pro" extension. following this advice

will save a big headache someday. when you manually compile your code, this tip

doesn't matter. do this if you want idl to automatically find your code (and you

will eventually, probably tomorrow).

把你的主程序放在文件的最后,

并把此程序名作为文件名,

".pro"

为扩展名。

或者你可以

把每个程序单独放在一个文件里,

以程序名作为文件名,

".pro"

为扩展名。

这样做的好处

是以后会给你省很多麻烦。

当你手动编译你的代码时,

这个方法是没什么用的。

如果你想要

idl

自动找到你的代码时(你最终肯定要的,可能就是明天),就要用这个方法了。

tip 3 be aware of short integers. the default integer in idl is a 16-bit ("short")

integer which has a range of -32,768 to 32,767. it is used in situations like:

n = 5

where no specific type of integer is specified. if you want to change the default

integer, put

compile_opt defint32

at

the

beginning

of

every

routine

where

you

want

to

change the

behavior.

or,

always

specify the type of integer you want, like

n = 5l

to create a long integer (32-bit).

注意短整型。

idl

中默认的整型是

16

(“短”)

整型,

它的取值范围是

-32,768

32,767

它用于下例情况下:

n = 5

这里没有指定整数的类型。如果你想要改变默认的整型,键入:

compile_opt defint32

在每个你想改变状态的程序的开头,或总是指定你想要的整型类型,如:

n = 5l

创建一个长整型(

32

位)

tip 4 put compile_opt strictarr at the beginning of every routine you write. the

explanation is a bit subtle, but doing this will save you a day's work sometime.

it

comes

down

to

the

fact

that

both

arr(5)

and

arr[5]

can

index

into

the

array

arr.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值