python读取grd数据_Matlab读取grd格式的⽂件
各位⾼⼿⼤家好,现在需要⽤matlab读取grd格式的⽂件,gre格式的⽂件格式如下:
DSAA
161 161
100 140
0 40
0.11658223001962 1.6478718159781
0.7145565 0.73377087241321 0.7433181 0.75345873789363 0.7733502999999 0.78376367343812
0.79438370001962 0.81515601213822 0.8260219 0.83717943789365
0.8577459999999 0.8684442879987 0.88890409998038 0.8990345 0.90873120001962 0.92788708543942 0.93638990001962 0.95411561929305 0.96095879999474 0.9768121776511
0.98154280000141 0.99502647010258 0.99720659999962 1.0080002401593 1.0071198000014
1.0146825676718 1.0106078000014 1.0147643692329 1.0072007999268 1.0078403000001python怎么读文件夹下的文件夹
1.0067033000732 0.99381948821712 0.98922669998038 0.97299531456059 0.96519859998038
0.94594965482326 0.93536860007321 0.9135943 0.89077749992679 0.87709047903037
0.85271319999474 0.8378479794304 0.8126842000001 0.79717836210634 0.7723446 0.74758808386178 0.73338422198038 0.70994488069951 0.6874726809 0.66616019099995
0.646194 0.62776031341105 0.62095994699859 0.60597702591429 0.592921088 0.58289350949841
0.56295129999997 0.55615910003688 0.5515383 0.54909540191694
0.54880139999859 0.54062823041176 0.5444548 0.54997186210701 0.5478578000001 0.55690026196608 0.5580245350001 0.57126002349841 0.57368458699987 0.57839503484746
0.59339237699859 0.5993114972873 0.60562830282679 0.62193602766717 0.62883516799869
0.63536175080457 0.64154155399477 0.64628563301152 0.6624403670732 0.66693607211949
0.67044909999821 0.67312661063036 0.67474679999464 0.67559145719652 0.67479000001961
0.67812586614571 0.68031860000526 0.67635218949739 0.67132000000179 0.66511175636277
0.66801000007321 0.65992206968647 0.6507628 0.64074188513698 0.64007329998038 0.62862255973757 0.61653699992679 0.61388496923289 0.60080440000141 0.59731941022199
0.58353660001962 0.57953337278684 0.57538950000038 0.56110835792383 0.5569784 0.55285070000019 0.5488611 0.54506702669946 0.54152109998038 0.52828601827212
0.53534529999859 0.53279720191694 0.5306532 0.52893750000265 0.5276686 0.52585279050159
0.53651140000003 0.53662997326361 0.53720360001962 0.5482139120013
0.5496459000001 0.56120496262 0.56367289999962 0.57627804259053 0.57903469999962
0.59220134015905 0.59545970000141 0.6089716692327 0.61268159992679 0.62649495973739
0.64039249998038 0.64434194713413 0.65832360000525 0.66128418338435 0.6762194 0.69109680949841 0.69387919999997 0.70857140935813 0.7111387000001 0.72431676214058
0.72789719999997 0.742071009536 0.74409169999997 0.75797800949571 0.7597117 0.7623263304084
0.77476069999859 0.77707490190706 0.77925150000001 0.7863013
0.79323319999999 0.79505610000988 0.7967766 0.7983994 0.7999324 0.8013784 0.8027451 0.8040341
0.8052562
......................
其中第⼀⾏为字符串DSAA
第⼆⾏为格⽹⽂件包含的⾏数和列数
第三⾏为格⽹范围中的X坐标的最⼩值和最⼤值
第四⾏为格⽹范围中的Y坐标的最⼩值和最⼤值
第五⾏为格⽹范围中的Z坐标的最⼩值和最⼤值
接着按照列的顺序依次排列格⽹数据。
利⽤matlab读取这种格式的⽂件时,fgetl读取前⼏⾏的⽂件说明,读取后每⼀⾏的所有内容被当做⼀个字符串读⼊,现在需要指定⽤空格将第2-5⾏的内容分开,分别得到⾏列数和X,Y,Z的最⼩值最⼤值。
其次,在读取后续的正式内容时,怎么设定依次将所有的数据按照空格分隔的⽅式存放到⼀个矩阵中去。
主要的问题是正⽂中⽂件长度不固定,需要如何制定使⽤空格依次读取数据。
请各位⾼⼿指点,谢谢。
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论