- 积分
- 3625
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2014-10-21
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
在桌面输出一个10列8行的数组(内容不重要):
function txt,name,x
openw,lun,'C:\Users\Administrator\Desktop\'+name+'.txt',/get_lun
printf,lun,x
close,/all
end
pro cat
tic
txt=txt('x',findgen(10,8))
toc
end
但当打开数组时发现:
原来10列8行居然变成了8个6+4的形式,而空白的地方也视为存在元素。
列数一多总是出现这种情况,我的解决办法是使用reform在读取时修正:
pro cat
tic
a=read_ascii('C:\Users\Administrator\Desktop\x.txt',data_start=0)
x=a.field1
y=reform(x,12,8)
toc
end
这时,y的前10列就是原本的10列8行的数据了。
|
评分
-
查看全部评分
|