我正在尝试加载一个 ASCII 文件,其中包含在某些行的第二个列中未定义的点,我这样做并收到此错误:
S = load('bond_order_correlation4A.dat')
??? Error using ==> load
Unknown text on line number 7 of ASCII file
C:\Users\VAIO\Desktop\MATLAB\R2010b\bin\bond_order_correlation4A.dat
"-nan+-nani".
如何避免此错误,以其他方式如何跳过阅读具有 NaN 的行?
有任何想法吗?
以下是数据行:
1.751500e+01 0.900636+0.000000i
1.854500e+01 0.910675+0.000000i
1.957500e+01 0.901020+0.000000i
2.060500e+01 0.866812+0.000000i
2.163500e+01 0.826753+0.000000i
2.266500e+01 0.736222+0.000000i
2.369500e+01 -nan+-nani
2.472500e+01 -nan+-nani
2.575500e+01 -nan+-nani
2.678500e+01 -nan+-nani
2.781500e+01 -nan+-nani
2.884500e+01 0.804500+0.000000i
2.987500e+01 0.863660+0.000000i
3.090500e+01 0.899600+0.000000i
3.193500e+01 0.912361+0.000000i
3.296500e+01 0.906553+0.000000i
3.399500e+01 0.883229+0.000000i
3.502500e+01 0.873248+0.000000i
3.605500e+01 0.903132+0.000000i
3.708500e+01 0.909807+0.000000i
3.811500e+01 0.904406+0.000000i
3.914500e+01 0.886968+0.000000i
4.017500e+01 0.860080+0.000000i
4.120500e+01 0.810715+0.000000i
4.223500e+01 -nan+-nani
4.326500e+01 -nan+-nani
4.429500e+01 -nan+-nani
4.532500e+01 0.812973+0.000000i
4.635500e+01 0.863783+0.000000i
4.738500e+01 0.895398+0.000000i
4.841500e+01 0.908204+0.000000i
4.944500e+01 0.908985+0.000000i
5.047500e+01 0.900171+0.000000i
5.150500e+01 0.882722+0.000000i
5.253500e+01 0.851140+0.000000i
5.356500e+01 0.890132+0.000000i
5.459500e+01 0.904564+0.000000i
5.562500e+01 0.908607+0.000000i
5.665500e+01 0.904241+0.000000i
5.768500e+01 0.891706+0.000000i
5.871500e+01 0.875118+0.000000i
5.974500e+01 0.844325+0.000000i
6.077500e+01 0.848961+0.000000i
6.180500e+01 0.883005+0.000000i
6.283500e+01 0.900617+0.000000i
6.386500e+01 0.907607+0.000000i
6.489500e+01 0.903102+0.000000i
6.592500e+01 0.903907+0.000000i
6.695500e+01 0.905971+0.000000i
6.798500e+01 0.901497+0.000000i
6.901500e+01 0.891710+0.000000i
7.004500e+01 0.873431+0.000000i
7.107500e+01 0.857750+0.000000i
7.210500e+01 0.892680+0.000000i
7.313500e+01 0.905379+0.000000i
7.416500e+01 0.907424+0.000000i
7.519500e+01 0.904534+0.000000i
7.622500e+01 0.891604+0.000000i
7.725500e+01 0.874679+0.000000i
7.828500e+01 0.880488+0.000000i
7.931500e+01 0.899794+0.000000i
8.034500e+01 0.908564+0.000000i
8.137500e+01 0.906300+0.000000i
8.240500e+01 0.898721+0.000000i
8.343500e+01 0.895449+0.000000i
8.446500e+01 0.900390+0.000000i
8.549500e+01 0.901614+0.000000i
8.652500e+01 0.896143+0.000000i
8.755500e+01 0.884075+0.000000i
8.858500e+01 0.860837+0.000000i
8.961500e+01 0.845785+0.000000i
9.064500e+01 0.883891+0.000000i
9.167500e+01 0.902221+0.000000i
9.270500e+01 0.905519+0.000000i
9.373500e+01 0.901589+0.000000i
9.476500e+01 0.892879+0.000000i
9.579500e+01 0.896607+0.000000i
9.682500e+01 0.900943+0.000000i
9.785500e+01 0.904287+0.000000i
9.888500e+01 0.901320+0.000000i
9.991500e+01 0.892640+0.000000i
1.009450e+02 0.884730+0.000000i
1.019750e+02 0.888384+0.000000i
1.030050e+02 0.895942+0.000000i
1.040350e+02 0.894981+0.000000i
1.050650e+02 0.887988+0.000000i
1.060950e+02 0.874380+0.000000i
1.071250e+02 0.853539+0.000000i
1.081550e+02 0.839207+0.000000i
1.091850e+02 0.867059+0.000000i
1.102150e+02 0.890265+0.000000i
1.112450e+02 0.899481+0.000000i
1.122750e+02 0.903685+0.000000i
1.133050e+02 0.899493+0.000000i
1.143350e+02 0.895112+0.000000i
1.153650e+02 0.896775+0.000000i
1.163950e+02 0.893841+0.000000i
1.174250e+02 0.885450+0.000000i
1.184550e+02 0.874641+0.000000i
1.194850e+02 0.871421+0.000000i
enter code here