how to read multiple folders with a single text file and remove header and footer from this text file

1 Ansicht (letzte 30 Tage)
I have 30 folders in 'E:\meta data\new\data _thesis\NCEP\potential_temperature' directory. These folders are name from 1985 to 2015. In each folder there is 12 folders name apr,aug,dec,feb,jan,july,jun,marc,may,nov,oct,sept. And in each sub folder there is a text file with name 'New Text Document.text'.
This text file look like
Dataset {
Grid {
ARRAY:
Float32 pottmp[time = 1][level = 17][lat = 8][lon = 8];
MAPS:
Float64 time[time = 1];
Float32 level[level = 17];
Float32 lat[lat = 8];
Float32 lon[lon = 8];
} pottmp;
} Datasets/ncep.reanalysis.derived/pressure/pottmp.mon.mean.nc;
---------------------------------------------
pottmp.pottmp[1][17][8][8]
[0][0][0], 295.13336, 295.40695, 295.14432, 294.30634, 293.34665, 292.88168, 293.1997, 293.99765
[0][0][1], 298.18265, 298.18234, 297.6957, 296.63467, 295.416, 294.73206, 294.9697, 295.85934
[0][0][2], 301.8217, 301.95905, 301.68268, 300.81802, 299.523, 298.34067, 297.75974, 297.83368
[0][0][3], 303.74838, 304.31403, 304.6887, 304.58835, 303.80136, 302.50162, 301.17197, 300.2617
[0][0][4], 303.41034, 304.0143, 304.78766, 305.5597, 305.812, 305.31836, 304.34036, 303.37033
[0][0][5], 302.32867, 302.09064, 302.47467, 303.53265, 304.754, 305.69733, 306.25897, 306.49597
[0][0][6], 301.52036, 300.1513, 299.69867, 300.3893, 301.99066, 304.19705, 306.58133, 308.39
[0][0][7], 300.62772, 298.95502, 298.16803, 298.41302, 299.84833, 302.60773, 306.06836, 308.72
[0][1][0], 298.18408, 298.39987, 298.05087, 297.1125, 295.95056, 295.17685, 295.21777, 295.94852
[0][1][1], 300.80356, 300.6471, 300.12015, 299.20496, 298.13132, 297.37668, 297.32114, 297.95032
[0][1][2], 303.93793, 303.88782, 303.6714, 303.20035, 302.43033, 301.54657, 300.86902, 300.59802
[0][1][3], 305.8954, 306.39578, 306.81982, 307.06552, 306.86545, 306.1374, 305.02966, 303.8548
[0][1][4], 306.09378, 306.8706, 307.63782, 308.36658, 308.8576, 308.88528, 308.3454, 307.30447
[0][1][5], 305.57605, 305.8617, 306.2301, 306.87256, 307.8137, 308.93948, 309.89862, 310.21188
[0][1][6], 305.25223, 304.64725, 304.3214, 304.5198, 305.5171, 307.47522, 309.9221, 311.8166
[0][1][7], 304.7607, 303.73645, 303.19525, 303.21298, 304.13327, 306.32214, 309.3771, 312.01328
[0][2][0], 300.6052, 300.76474, 300.58496, 299.82404, 298.72336, 297.89447, 297.8466, 298.51706
[0][2][1], 303.76877, 303.57916, 303.0547, 302.10455, 300.96588, 300.19345, 300.18964, 300.82306
[0][2][2], 307.06897, 307.03714, 306.72458, 306.0039, 304.9993, 304.0932, 303.60822, 303.5627
[0][2][3], 308.88574, 309.43393, 309.7199, 309.5405, 308.855, 307.89093, 306.96695, 306.2428
[0][2][4], 308.74188, 309.6089, 310.25238, 310.4843, 310.2196, 309.65182, 309.02963, 308.4458
[0][2][5], 307.66077, 308.16046, 308.5777, 308.82913, 308.9667, 309.2192, 309.68744, 310.15918
[0][2][6], 306.8402, 306.63693, 306.60938, 306.72147, 307.18134, 308.25406, 309.88965, 311.4924
[0][2][7], 306.53015, 305.9735, 305.80243, 305.9749, 306.6974, 308.21075, 310.34573, 312.3036
[0][3][0], 305.61276, 306.0447, 306.27133, 306.0458, 305.46222, 304.94394, 304.97424, 305.58142
[0][3][1], 307.68503, 308.13162, 308.41992, 308.28738, 307.7189, 307.08334, 306.83493, 307.11807
[0][3][2], 309.6904, 310.1134, 310.47327, 310.50168, 310.0883, 309.4409, 308.96213, 308.92227
[0][3][3], 310.9417, 311.27606, 311.60205, 311.70648, 311.4167, 310.8612, 310.34924, 310.20416
[0][3][4], 311.3864, 311.67395, 311.9383, 311.99728, 311.75113, 311.31522, 310.9553, 310.90625
[0][3][5], 311.4762, 311.90808, 312.23242, 312.26825, 312.0402, 311.73047, 311.59134, 311.70203
[0][3][6], 311.57394, 312.26266, 312.76724, 312.87585, 312.68393, 312.50818, 312.55252, 312.78134
[0][3][7], 311.8054, 312.57568, 313.12906, 313.25085, 313.09802, 313.01532, 313.1652, 313.43982
[0][4][0], 309.52737, 309.88763, 310.12912, 310.34393, 310.61826, 310.92682, 311.20068, 311.3793
[0][4][1], 310.85202, 311.2547, 311.46335, 311.60104, 311.77277, 311.99838, 312.2152, 312.42697
[0][4][2], 311.95947, 312.36563, 312.53918, 312.5932, 312.64297, 312.70352, 312.79037, 313.00592
[0][4][3], 313.283, 313.62204, 313.78168, 313.81677, 313.8187, 313.76083, 313.68753, 313.77438
[0][4][4], 314.82013, 315.08856, 315.26907, 315.3991, 315.48166, 315.45233, 315.2818, 315.12057
[0][4][5], 316.1621, 316.40436, 316.62497, 316.86844, 317.1137, 317.19855, 316.99454, 316.5968
[0][4][6], 317.22482, 317.47592, 317.7074, 317.96817, 318.24084, 318.31992, 318.04453, 317.51453
[0][4][7], 318.2667, 318.51743, 318.69028, 318.83572, 318.9209, 318.7616, 318.30066, 317.7193
[0][5][0], 313.5312, 313.9453, 314.21805, 314.3752, 314.54343, 314.83524, 315.2534, 315.67484
[0][5][1], 314.52274, 314.97665, 315.26355, 315.39316, 315.5094, 315.79306, 316.27588, 316.8809
[0][5][2], 315.65692, 316.134, 316.477, 316.61682, 316.68954, 316.84763, 317.1963, 317.7481
[0][5][3], 317.3804, 317.82986, 318.17487, 318.34314, 318.41663, 318.46097, 318.55765, 318.80472
[0][5][4], 319.56302, 319.88324, 320.1243, 320.28275, 320.39932, 320.46033, 320.40912, 320.33353
[0][5][5], 321.5307, 321.686, 321.7823, 321.91068, 322.0879, 322.25162, 322.24875, 322.06635
[0][5][6], 322.89328, 322.96683, 323.02942, 323.13998, 323.372, 323.5996, 323.6675, 323.55206
[0][5][7], 323.90927, 324.02264, 324.1665, 324.34485, 324.55704, 324.71063, 324.75574, 324.70374
[0][6][0], 318.28473, 318.65988, 318.81537, 318.8734, 318.97824, 319.21298, 319.5071, 319.71768
[0][6][1], 319.5236, 319.9052, 320.09097, 320.1746, 320.33182, 320.62683, 320.9499, 321.20068
[0][6][2], 321.1292, 321.51257, 321.74994, 321.91977, 322.1445, 322.4642, 322.7834, 323.00427
[0][6][3], 323.1589, 323.52582, 323.80432, 324.0382, 324.31717, 324.6598, 324.94693, 325.16263
[0][6][4], 325.2939, 325.63266, 325.91116, 326.1671, 326.45514, 326.76016, 327.03604, 327.3037
[0][6][5], 327.1859, 327.48615, 327.7572, 328.00107, 328.24234, 328.48355, 328.72748, 329.02896
[0][6][6], 328.80023, 329.0878, 329.32562, 329.547, 329.73492, 329.90253, 330.11313, 330.42365
[0][6][7], 330.35388, 330.57825, 330.78098, 330.94647, 331.10843, 331.25574, 331.4498, 331.77158
[0][7][0], 323.33923, 323.69193, 324.05307, 324.4961, 324.93155, 325.24332, 325.3472, 325.25504
[0][7][1], 325.54523, 326.00424, 326.52762, 327.0741, 327.59326, 327.98495, 328.19614, 328.2291
[0][7][2], 327.99066, 328.51407, 329.09296, 329.68927, 330.23007, 330.73563, 331.12216, 331.39255
[0][7][3], 330.35464, 330.9161, 331.54065, 332.1248, 332.64346, 333.1716, 333.6926, 334.16855
[0][7][4], 332.6402, 333.2652, 333.90286, 334.4333, 334.841, 335.2709, 335.7482, 336.25653
[0][7][5], 334.89798, 335.4933, 336.06653, 336.4837, 336.76352, 337.04196, 337.3866, 337.79904
[0][7][6], 336.9413, 337.37997, 337.77127, 338.0633, 338.26276, 338.4575, 338.74188, 339.0862
[0][7][7], 338.54584, 338.7809, 338.9639, 339.13693, 339.32178, 339.5513, 339.86868, 340.2153
[0][8][0], 328.92233, 329.1092, 329.50946, 330.10446, 330.67416, 331.00214, 331.06555, 330.97342
[0][8][1], 331.58676, 332.02872, 332.67374, 333.48178, 334.22397, 334.68713, 334.84274, 334.82095
[0][8][2], 334.5247, 335.085, 335.81534, 336.6699, 337.46805, 338.05264, 338.41574, 338.607
[0][8][3], 337.1608, 337.7707, 338.4792, 339.2218, 339.9125, 340.50894, 340.98956, 341.37994
[0][8][4], 339.43195, 340.06158, 340.69424, 341.24918, 341.68753, 342.07806, 342.49316, 342.94547
[0][8][5], 341.45673, 342.0537, 342.569, 342.9118, 343.10205, 343.22882, 343.4439, 343.78824
[0][8][6], 343.09906, 343.54303, 343.9215, 344.13504, 344.19003, 344.1816, 344.26132, 344.4848
[0][8][7], 344.14044, 344.4035, 344.63934, 344.8078, 344.8648, 344.8782, 344.92673, 345.0783
[0][9][0], 344.3527, 344.21225, 344.2381, 344.3463, 344.41132, 344.35855, 344.19742, 344.0575
[0][9][1], 346.46283, 346.54944, 346.78653, 347.1631, 347.5063, 347.6298, 347.51788, 347.26703
[0][9][2], 348.64005, 348.87073, 349.22882, 349.77847, 350.32715, 350.65347, 350.66513, 350.4518
[0][9][3], 350.27704, 350.52728, 350.87787, 351.40756, 351.99112, 352.41086, 352.5709, 352.554
[0][9][4], 351.21695, 351.4599, 351.73758, 352.13474, 352.53653, 352.87503, 353.1227, 353.2944
[0][9][5], 351.6784, 351.97372, 352.23447, 352.46158, 352.64435, 352.8254, 353.0456, 353.3324
[0][9][6], 351.8602, 352.22128, 352.50644, 352.65805, 352.73407, 352.82068, 353.03558, 353.28116
[0][9][7], 351.7999, 352.17538, 352.43463, 352.57568, 352.6638, 352.80853, 353.01233, 353.15652
[0][10][0], 373.08575, 372.7338, 372.34326, 371.99646, 371.65643, 371.20697, 370.60672, 369.9055
[0][10][1], 372.71082, 372.2911, 371.83075, 371.50735, 371.28897, 370.9932, 370.51154, 369.8906
[0][10][2], 371.5292, 371.0934, 370.58093, 370.26956, 370.15436, 370.02594, 369.7519, 369.39352
[0][10][3], 369.2731, 368.84082, 368.38565, 368.1421, 368.10934, 368.0812, 367.98206, 367.85535
[0][10][4], 366.41913, 366.08838, 365.796, 365.69504, 365.76672, 365.80685, 365.73404, 365.6423
[0][10][5], 363.77783, 363.61966, 363.5703, 363.6655, 363.81113, 363.86615, 363.7492, 363.56342
[0][10][6], 361.72824, 361.80392, 361.9593, 362.15137, 362.3182, 362.36063, 362.2585, 362.0247
[0][10][7], 360.22385, 360.49332, 360.74213, 360.91013, 361.00992, 361.04315, 360.9714, 360.81894
[0][11][0], 406.979, 406.7112, 406.48074, 406.28696, 406.1852, 406.15305, 406.13437, 406.00363
[0][11][1], 403.37448, 403.1537, 402.85364, 402.46094, 402.10046, 401.9131, 401.86356, 401.78632
[0][11][2], 399.18475, 398.8043, 398.3421, 397.71506, 397.13434, 396.806, 396.7075, 396.61935
[0][11][3], 394.31522, 393.69464, 393.10754, 392.45282, 391.83994, 391.46332, 391.34747, 391.26508
[0][11][4], 389.3524, 388.65906, 388.17365, 387.68564, 387.20215, 386.86737, 386.67102, 386.52106
[0][11][5], 385.27988, 384.82794, 384.57297, 384.31674, 383.94977, 383.50943, 383.1122, 382.75238
[0][11][6], 382.60748, 382.4421, 382.3841, 382.22824, 381.8183, 381.1771, 380.4335, 379.77554
[0][11][7], 380.93945, 380.90146, 380.85, 380.64468, 380.18054, 379.38736, 378.40945, 377.4682
[0][12][0], 445.32266, 444.59622, 443.80707, 443.02576, 442.36566, 441.9328, 441.80957, 442.01062
[0][12][1], 441.65915, 440.9014, 440.1343, 439.44992, 438.85687, 438.34708, 437.91653, 437.6136
[0][12][2], 438.04483, 437.38684, 436.74094, 436.18134, 435.6574, 435.08936, 434.33368, 433.43466
[0][12][3], 434.92535, 434.40775, 433.80966, 433.25574, 432.7596, 432.18716, 431.3795, 430.33582
[0][12][4], 432.3219, 431.8328, 431.1506, 430.4556, 429.89102, 429.34067, 428.70404, 427.9327
[0][12][5], 430.1155, 429.57443, 428.7568, 427.92917, 427.19272, 426.59174, 426.02005, 425.5253
[0][12][6], 428.26273, 427.66895, 426.8128, 425.98294, 425.24518, 424.53223, 423.82867, 423.29538
[0][12][7], 426.67725, 426.0592, 425.283, 424.60928, 424.0539, 423.38736, 422.62033, 421.99014
[0][13][0], 495.17526, 494.84174, 494.35358, 493.69904, 492.98163, 492.37186, 491.9598, 491.72977
[0][13][1], 493.96277, 493.62128, 493.12924, 492.4213, 491.53836, 490.67026, 489.98196, 489.54163
[0][13][2], 492.5846, 492.2329, 491.8389, 491.2204, 490.3272, 489.31726, 488.40762, 487.79773
[0][13][3], 491.3429, 491.01642, 490.6829, 490.1876, 489.4028, 488.42563, 487.48303, 486.75775
[0][13][4], 490.36655, 490.02048, 489.62173, 489.11783, 488.39346, 487.5128, 486.64325, 485.94077
[0][13][5], 489.41605, 488.9781, 488.42477, 487.73178, 486.9266, 486.11728, 485.38193, 484.8035
[0][13][6], 488.2239, 487.70276, 486.99646, 486.16443, 485.2972, 484.55157, 483.99515, 483.60345
[0][13][7], 486.8873, 486.38895, 485.7194, 484.91882, 484.15363, 483.57675, 483.2173, 483.0015
[0][14][0], 587.2294, 587.0396, 586.7298, 586.23303, 585.7371, 585.5555, 585.6572, 585.8616
[0][14][1], 587.3656, 587.2158, 587.12946, 586.8552, 586.4456, 586.20764, 586.22943, 586.35565
[0][14][2], 587.7952, 587.4937, 587.5782, 587.58624, 587.35925, 587.11676, 587.045, 587.0023
[0][14][3], 588.37286, 587.84064, 587.93964, 588.11035, 588.0523, 587.80524, 587.5736, 587.43097
[0][14][4], 588.5436, 587.9587, 588.0731, 588.3701, 588.39276, 588.1377, 587.87415, 587.7698
[0][14][5], 588.02234, 587.6263, 587.976, 588.47095, 588.64435, 588.5028, 588.3329, 588.3265
[0][14][6], 587.1894, 587.2349, 587.8906, 588.59265, 588.9596, 589.0431, 589.1176, 589.1857
[0][14][7], 586.8106, 587.2403, 588.0759, 588.83606, 589.2838, 589.60266, 589.86957, 589.9459
[0][15][0], 677.61127, 676.9789, 676.3252, 675.86835, 675.6062, 675.4788, 675.53687, 675.9528
[0][15][1], 678.08136, 677.4715, 676.727, 676.1977, 675.88776, 675.696, 675.52875, 675.6399
[0][15][2], 678.3292, 678.04065, 677.3929, 676.8126, 676.4649, 676.28033, 676.16, 676.3121
[0][15][3], 678.8748, 679.0778, 678.6973, 678.10486, 677.7194, 677.59784, 677.70197, 678.08344
[0][15][4], 679.7213, 680.37616, 680.38824, 679.9477, 679.61835, 679.6019, 679.8774, 680.34766
[0][15][5], 680.678, 681.4867, 681.84973, 681.73254, 681.5897, 681.6101, 681.8477, 682.18225
[0][15][6], 681.657, 682.3016, 682.8472, 683.06226, 683.09906, 682.98083, 682.893, 683.06445
[0][15][7], 682.7799, 683.03394, 683.59875, 684.0925, 684.14044, 683.6865, 683.20715, 683.25104
[0][16][0], 872.15247, 875.8923, 879.8187, 882.02814, 882.46576, 882.46954, 882.85126, 883.1807
[0][16][1], 877.0001, 880.11096, 883.71674, 885.3156, 884.8133, 884.1991, 885.0534, 886.70575
[0][16][2], 882.46216, 884.02374, 886.41223, 887.09863, 885.7347, 884.46387, 885.2397, 887.4753
[0][16][3], 885.3889, 885.27704, 886.39856, 886.4322, 884.7113, 883.0353, 883.36115, 885.40265
[0][16][4], 885.0074, 884.0188, 884.4739, 884.63434, 883.3711, 881.92377, 881.9412, 883.43195
[0][16][5], 883.21185, 882.2519, 882.7181, 883.4307, 883.264, 882.8126, 883.18823, 884.2301
[0][16][6], 881.83685, 881.3681, 882.02576, 883.06024, 883.91437, 884.8818, 886.2607, 887.2179
[0][16][7], 881.4078, 881.48987, 882.09906, 882.87494, 884.0972, 886.24695, 888.6479, 889.6661
pottmp.time[1]
1623840.0
pottmp.level[17]
1000.0, 925.0, 850.0, 700.0, 600.0, 500.0, 400.0, 300.0, 250.0, 200.0, 150.0, 100.0, 70.0, 50.0, 30.0, 20.0, 10.0
pottmp.lat[8]
37.5, 35.0, 32.5, 30.0, 27.5, 25.0, 22.5, 20.0
pottmp.lon[8]
60.0, 62.5, 65.0, 67.5, 70.0, 72.5, 75.0, 77.5
i want to remove its header and footer and want to save this file in the save folder where i has read. after removing header and footer it looks like
[0][0][0], 295.13336, 295.40695, 295.14432, 294.30634, 293.34665, 292.88168, 293.1997, 293.99765
[0][0][1], 298.18265, 298.18234, 297.6957, 296.63467, 295.416, 294.73206, 294.9697, 295.85934
[0][0][2], 301.8217, 301.95905, 301.68268, 300.81802, 299.523, 298.34067, 297.75974, 297.83368
[0][0][3], 303.74838, 304.31403, 304.6887, 304.58835, 303.80136, 302.50162, 301.17197, 300.2617
[0][0][4], 303.41034, 304.0143, 304.78766, 305.5597, 305.812, 305.31836, 304.34036, 303.37033
[0][0][5], 302.32867, 302.09064, 302.47467, 303.53265, 304.754, 305.69733, 306.25897, 306.49597
[0][0][6], 301.52036, 300.1513, 299.69867, 300.3893, 301.99066, 304.19705, 306.58133, 308.39
[0][0][7], 300.62772, 298.95502, 298.16803, 298.41302, 299.84833, 302.60773, 306.06836, 308.72
[0][1][0], 298.18408, 298.39987, 298.05087, 297.1125, 295.95056, 295.17685, 295.21777, 295.94852
[0][1][1], 300.80356, 300.6471, 300.12015, 299.20496, 298.13132, 297.37668, 297.32114, 297.95032
[0][1][2], 303.93793, 303.88782, 303.6714, 303.20035, 302.43033, 301.54657, 300.86902, 300.59802
[0][1][3], 305.8954, 306.39578, 306.81982, 307.06552, 306.86545, 306.1374, 305.02966, 303.8548
[0][1][4], 306.09378, 306.8706, 307.63782, 308.36658, 308.8576, 308.88528, 308.3454, 307.30447
[0][1][5], 305.57605, 305.8617, 306.2301, 306.87256, 307.8137, 308.93948, 309.89862, 310.21188
[0][1][6], 305.25223, 304.64725, 304.3214, 304.5198, 305.5171, 307.47522, 309.9221, 311.8166
[0][1][7], 304.7607, 303.73645, 303.19525, 303.21298, 304.13327, 306.32214, 309.3771, 312.01328
[0][2][0], 300.6052, 300.76474, 300.58496, 299.82404, 298.72336, 297.89447, 297.8466, 298.51706
[0][2][1], 303.76877, 303.57916, 303.0547, 302.10455, 300.96588, 300.19345, 300.18964, 300.82306
[0][2][2], 307.06897, 307.03714, 306.72458, 306.0039, 304.9993, 304.0932, 303.60822, 303.5627
[0][2][3], 308.88574, 309.43393, 309.7199, 309.5405, 308.855, 307.89093, 306.96695, 306.2428
[0][2][4], 308.74188, 309.6089, 310.25238, 310.4843, 310.2196, 309.65182, 309.02963, 308.4458
[0][2][5], 307.66077, 308.16046, 308.5777, 308.82913, 308.9667, 309.2192, 309.68744, 310.15918
[0][2][6], 306.8402, 306.63693, 306.60938, 306.72147, 307.18134, 308.25406, 309.88965, 311.4924
[0][2][7], 306.53015, 305.9735, 305.80243, 305.9749, 306.6974, 308.21075, 310.34573, 312.3036
[0][3][0], 305.61276, 306.0447, 306.27133, 306.0458, 305.46222, 304.94394, 304.97424, 305.58142
[0][3][1], 307.68503, 308.13162, 308.41992, 308.28738, 307.7189, 307.08334, 306.83493, 307.11807
[0][3][2], 309.6904, 310.1134, 310.47327, 310.50168, 310.0883, 309.4409, 308.96213, 308.92227
[0][3][3], 310.9417, 311.27606, 311.60205, 311.70648, 311.4167, 310.8612, 310.34924, 310.20416
[0][3][4], 311.3864, 311.67395, 311.9383, 311.99728, 311.75113, 311.31522, 310.9553, 310.90625
[0][3][5], 311.4762, 311.90808, 312.23242, 312.26825, 312.0402, 311.73047, 311.59134, 311.70203
[0][3][6], 311.57394, 312.26266, 312.76724, 312.87585, 312.68393, 312.50818, 312.55252, 312.78134
[0][3][7], 311.8054, 312.57568, 313.12906, 313.25085, 313.09802, 313.01532, 313.1652, 313.43982
[0][4][0], 309.52737, 309.88763, 310.12912, 310.34393, 310.61826, 310.92682, 311.20068, 311.3793
[0][4][1], 310.85202, 311.2547, 311.46335, 311.60104, 311.77277, 311.99838, 312.2152, 312.42697
[0][4][2], 311.95947, 312.36563, 312.53918, 312.5932, 312.64297, 312.70352, 312.79037, 313.00592
[0][4][3], 313.283, 313.62204, 313.78168, 313.81677, 313.8187, 313.76083, 313.68753, 313.77438
[0][4][4], 314.82013, 315.08856, 315.26907, 315.3991, 315.48166, 315.45233, 315.2818, 315.12057
[0][4][5], 316.1621, 316.40436, 316.62497, 316.86844, 317.1137, 317.19855, 316.99454, 316.5968
[0][4][6], 317.22482, 317.47592, 317.7074, 317.96817, 318.24084, 318.31992, 318.04453, 317.51453
[0][4][7], 318.2667, 318.51743, 318.69028, 318.83572, 318.9209, 318.7616, 318.30066, 317.7193
[0][5][0], 313.5312, 313.9453, 314.21805, 314.3752, 314.54343, 314.83524, 315.2534, 315.67484
[0][5][1], 314.52274, 314.97665, 315.26355, 315.39316, 315.5094, 315.79306, 316.27588, 316.8809
[0][5][2], 315.65692, 316.134, 316.477, 316.61682, 316.68954, 316.84763, 317.1963, 317.7481
[0][5][3], 317.3804, 317.82986, 318.17487, 318.34314, 318.41663, 318.46097, 318.55765, 318.80472
[0][5][4], 319.56302, 319.88324, 320.1243, 320.28275, 320.39932, 320.46033, 320.40912, 320.33353
[0][5][5], 321.5307, 321.686, 321.7823, 321.91068, 322.0879, 322.25162, 322.24875, 322.06635
[0][5][6], 322.89328, 322.96683, 323.02942, 323.13998, 323.372, 323.5996, 323.6675, 323.55206
[0][5][7], 323.90927, 324.02264, 324.1665, 324.34485, 324.55704, 324.71063, 324.75574, 324.70374
[0][6][0], 318.28473, 318.65988, 318.81537, 318.8734, 318.97824, 319.21298, 319.5071, 319.71768
[0][6][1], 319.5236, 319.9052, 320.09097, 320.1746, 320.33182, 320.62683, 320.9499, 321.20068
[0][6][2], 321.1292, 321.51257, 321.74994, 321.91977, 322.1445, 322.4642, 322.7834, 323.00427
[0][6][3], 323.1589, 323.52582, 323.80432, 324.0382, 324.31717, 324.6598, 324.94693, 325.16263
[0][6][4], 325.2939, 325.63266, 325.91116, 326.1671, 326.45514, 326.76016, 327.03604, 327.3037
[0][6][5], 327.1859, 327.48615, 327.7572, 328.00107, 328.24234, 328.48355, 328.72748, 329.02896
[0][6][6], 328.80023, 329.0878, 329.32562, 329.547, 329.73492, 329.90253, 330.11313, 330.42365
[0][6][7], 330.35388, 330.57825, 330.78098, 330.94647, 331.10843, 331.25574, 331.4498, 331.77158
[0][7][0], 323.33923, 323.69193, 324.05307, 324.4961, 324.93155, 325.24332, 325.3472, 325.25504
[0][7][1], 325.54523, 326.00424, 326.52762, 327.0741, 327.59326, 327.98495, 328.19614, 328.2291
[0][7][2], 327.99066, 328.51407, 329.09296, 329.68927, 330.23007, 330.73563, 331.12216, 331.39255
[0][7][3], 330.35464, 330.9161, 331.54065, 332.1248, 332.64346, 333.1716, 333.6926, 334.16855
[0][7][4], 332.6402, 333.2652, 333.90286, 334.4333, 334.841, 335.2709, 335.7482, 336.25653
[0][7][5], 334.89798, 335.4933, 336.06653, 336.4837, 336.76352, 337.04196, 337.3866, 337.79904
[0][7][6], 336.9413, 337.37997, 337.77127, 338.0633, 338.26276, 338.4575, 338.74188, 339.0862
[0][7][7], 338.54584, 338.7809, 338.9639, 339.13693, 339.32178, 339.5513, 339.86868, 340.2153
[0][8][0], 328.92233, 329.1092, 329.50946, 330.10446, 330.67416, 331.00214, 331.06555, 330.97342
[0][8][1], 331.58676, 332.02872, 332.67374, 333.48178, 334.22397, 334.68713, 334.84274, 334.82095
[0][8][2], 334.5247, 335.085, 335.81534, 336.6699, 337.46805, 338.05264, 338.41574, 338.607
[0][8][3], 337.1608, 337.7707, 338.4792, 339.2218, 339.9125, 340.50894, 340.98956, 341.37994
[0][8][4], 339.43195, 340.06158, 340.69424, 341.24918, 341.68753, 342.07806, 342.49316, 342.94547
[0][8][5], 341.45673, 342.0537, 342.569, 342.9118, 343.10205, 343.22882, 343.4439, 343.78824
[0][8][6], 343.09906, 343.54303, 343.9215, 344.13504, 344.19003, 344.1816, 344.26132, 344.4848
[0][8][7], 344.14044, 344.4035, 344.63934, 344.8078, 344.8648, 344.8782, 344.92673, 345.0783
[0][9][0], 344.3527, 344.21225, 344.2381, 344.3463, 344.41132, 344.35855, 344.19742, 344.0575
[0][9][1], 346.46283, 346.54944, 346.78653, 347.1631, 347.5063, 347.6298, 347.51788, 347.26703
[0][9][2], 348.64005, 348.87073, 349.22882, 349.77847, 350.32715, 350.65347, 350.66513, 350.4518
[0][9][3], 350.27704, 350.52728, 350.87787, 351.40756, 351.99112, 352.41086, 352.5709, 352.554
[0][9][4], 351.21695, 351.4599, 351.73758, 352.13474, 352.53653, 352.87503, 353.1227, 353.2944
[0][9][5], 351.6784, 351.97372, 352.23447, 352.46158, 352.64435, 352.8254, 353.0456, 353.3324
[0][9][6], 351.8602, 352.22128, 352.50644, 352.65805, 352.73407, 352.82068, 353.03558, 353.28116
[0][9][7], 351.7999, 352.17538, 352.43463, 352.57568, 352.6638, 352.80853, 353.01233, 353.15652
[0][10][0], 373.08575, 372.7338, 372.34326, 371.99646, 371.65643, 371.20697, 370.60672, 369.9055
[0][10][1], 372.71082, 372.2911, 371.83075, 371.50735, 371.28897, 370.9932, 370.51154, 369.8906
[0][10][2], 371.5292, 371.0934, 370.58093, 370.26956, 370.15436, 370.02594, 369.7519, 369.39352
[0][10][3], 369.2731, 368.84082, 368.38565, 368.1421, 368.10934, 368.0812, 367.98206, 367.85535
[0][10][4], 366.41913, 366.08838, 365.796, 365.69504, 365.76672, 365.80685, 365.73404, 365.6423
[0][10][5], 363.77783, 363.61966, 363.5703, 363.6655, 363.81113, 363.86615, 363.7492, 363.56342
[0][10][6], 361.72824, 361.80392, 361.9593, 362.15137, 362.3182, 362.36063, 362.2585, 362.0247
[0][10][7], 360.22385, 360.49332, 360.74213, 360.91013, 361.00992, 361.04315, 360.9714, 360.81894
[0][11][0], 406.979, 406.7112, 406.48074, 406.28696, 406.1852, 406.15305, 406.13437, 406.00363
[0][11][1], 403.37448, 403.1537, 402.85364, 402.46094, 402.10046, 401.9131, 401.86356, 401.78632
[0][11][2], 399.18475, 398.8043, 398.3421, 397.71506, 397.13434, 396.806, 396.7075, 396.61935
[0][11][3], 394.31522, 393.69464, 393.10754, 392.45282, 391.83994, 391.46332, 391.34747, 391.26508
[0][11][4], 389.3524, 388.65906, 388.17365, 387.68564, 387.20215, 386.86737, 386.67102, 386.52106
[0][11][5], 385.27988, 384.82794, 384.57297, 384.31674, 383.94977, 383.50943, 383.1122, 382.75238
[0][11][6], 382.60748, 382.4421, 382.3841, 382.22824, 381.8183, 381.1771, 380.4335, 379.77554
[0][11][7], 380.93945, 380.90146, 380.85, 380.64468, 380.18054, 379.38736, 378.40945, 377.4682
[0][12][0], 445.32266, 444.59622, 443.80707, 443.02576, 442.36566, 441.9328, 441.80957, 442.01062
[0][12][1], 441.65915, 440.9014, 440.1343, 439.44992, 438.85687, 438.34708, 437.91653, 437.6136
[0][12][2], 438.04483, 437.38684, 436.74094, 436.18134, 435.6574, 435.08936, 434.33368, 433.43466
[0][12][3], 434.92535, 434.40775, 433.80966, 433.25574, 432.7596, 432.18716, 431.3795, 430.33582
[0][12][4], 432.3219, 431.8328, 431.1506, 430.4556, 429.89102, 429.34067, 428.70404, 427.9327
[0][12][5], 430.1155, 429.57443, 428.7568, 427.92917, 427.19272, 426.59174, 426.02005, 425.5253
[0][12][6], 428.26273, 427.66895, 426.8128, 425.98294, 425.24518, 424.53223, 423.82867, 423.29538
[0][12][7], 426.67725, 426.0592, 425.283, 424.60928, 424.0539, 423.38736, 422.62033, 421.99014
[0][13][0], 495.17526, 494.84174, 494.35358, 493.69904, 492.98163, 492.37186, 491.9598, 491.72977
[0][13][1], 493.96277, 493.62128, 493.12924, 492.4213, 491.53836, 490.67026, 489.98196, 489.54163
[0][13][2], 492.5846, 492.2329, 491.8389, 491.2204, 490.3272, 489.31726, 488.40762, 487.79773
[0][13][3], 491.3429, 491.01642, 490.6829, 490.1876, 489.4028, 488.42563, 487.48303, 486.75775
[0][13][4], 490.36655, 490.02048, 489.62173, 489.11783, 488.39346, 487.5128, 486.64325, 485.94077
[0][13][5], 489.41605, 488.9781, 488.42477, 487.73178, 486.9266, 486.11728, 485.38193, 484.8035
[0][13][6], 488.2239, 487.70276, 486.99646, 486.16443, 485.2972, 484.55157, 483.99515, 483.60345
[0][13][7], 486.8873, 486.38895, 485.7194, 484.91882, 484.15363, 483.57675, 483.2173, 483.0015
[0][14][0], 587.2294, 587.0396, 586.7298, 586.23303, 585.7371, 585.5555, 585.6572, 585.8616
[0][14][1], 587.3656, 587.2158, 587.12946, 586.8552, 586.4456, 586.20764, 586.22943, 586.35565
[0][14][2], 587.7952, 587.4937, 587.5782, 587.58624, 587.35925, 587.11676, 587.045, 587.0023
[0][14][3], 588.37286, 587.84064, 587.93964, 588.11035, 588.0523, 587.80524, 587.5736, 587.43097
[0][14][4], 588.5436, 587.9587, 588.0731, 588.3701, 588.39276, 588.1377, 587.87415, 587.7698
[0][14][5], 588.02234, 587.6263, 587.976, 588.47095, 588.64435, 588.5028, 588.3329, 588.3265
[0][14][6], 587.1894, 587.2349, 587.8906, 588.59265, 588.9596, 589.0431, 589.1176, 589.1857
[0][14][7], 586.8106, 587.2403, 588.0759, 588.83606, 589.2838, 589.60266, 589.86957, 589.9459
[0][15][0], 677.61127, 676.9789, 676.3252, 675.86835, 675.6062, 675.4788, 675.53687, 675.9528
[0][15][1], 678.08136, 677.4715, 676.727, 676.1977, 675.88776, 675.696, 675.52875, 675.6399
[0][15][2], 678.3292, 678.04065, 677.3929, 676.8126, 676.4649, 676.28033, 676.16, 676.3121
[0][15][3], 678.8748, 679.0778, 678.6973, 678.10486, 677.7194, 677.59784, 677.70197, 678.08344
[0][15][4], 679.7213, 680.37616, 680.38824, 679.9477, 679.61835, 679.6019, 679.8774, 680.34766
[0][15][5], 680.678, 681.4867, 681.84973, 681.73254, 681.5897, 681.6101, 681.8477, 682.18225
[0][15][6], 681.657, 682.3016, 682.8472, 683.06226, 683.09906, 682.98083, 682.893, 683.06445
[0][15][7], 682.7799, 683.03394, 683.59875, 684.0925, 684.14044, 683.6865, 683.20715, 683.25104
[0][16][0], 872.15247, 875.8923, 879.8187, 882.02814, 882.46576, 882.46954, 882.85126, 883.1807
[0][16][1], 877.0001, 880.11096, 883.71674, 885.3156, 884.8133, 884.1991, 885.0534, 886.70575
[0][16][2], 882.46216, 884.02374, 886.41223, 887.09863, 885.7347, 884.46387, 885.2397, 887.4753
[0][16][3], 885.3889, 885.27704, 886.39856, 886.4322, 884.7113, 883.0353, 883.36115, 885.40265
[0][16][4], 885.0074, 884.0188, 884.4739, 884.63434, 883.3711, 881.92377, 881.9412, 883.43195
[0][16][5], 883.21185, 882.2519, 882.7181, 883.4307, 883.264, 882.8126, 883.18823, 884.2301
[0][16][6], 881.83685, 881.3681, 882.02576, 883.06024, 883.91437, 884.8818, 886.2607, 887.2179
[0][16][7], 881.4078, 881.48987, 882.09906, 882.87494, 884.0972, 886.24695, 888.6479, 889.6661
Please help???

Akzeptierte Antwort

Muhammad Usman Saleem
Muhammad Usman Saleem am 14 Apr. 2016
Bearbeitet: Muhammad Usman Saleem am 14 Apr. 2016
basedir = 'E:\meta data\new\data _thesis\NCEP\winds_speed';
% Helper function to remove '.' and '..' and get directories
get_dirs = @(s){s(~ismember({s.name}, {'.', '..'}) & [s.isdir]).name};
% Find year directories and turn into full paths
yeardirs = get_dirs(dir(basedir));
yeardirs = cellfun(@(x)fullfile(basedir, x), yeardirs, 'uni', 0);

Weitere Antworten (1)

Ahmet Cecen
Ahmet Cecen am 19 Mär. 2016
Bearbeitet: Ahmet Cecen am 19 Mär. 2016
Create a for looped chain using dir to access the folders. Something like:
years = dir; years(1:2) = [];
for yy = 1:length(years)
months = dir; months(1:2) = [];
for mm = 1:length(months)
file = dir('*.txt');
EDIT EACH FILE HERE
end
end
Now, about editing each file, if your header and footer are always formatted the same way (header is constant length, footer has pottmp as the first string):
fid = fopen(file(1).name);
Data = textscan(fid,'%s','Delimiter','\n');
Data = Data{1};
Data(1:13) = []; % This Deletes the Header
FooterInd = find(strncmp(Data,'pottmp',6)); FooterInd = FooterInd(1);
Data(FooterInd:end) = [];
WRITE YOUR FILE HERE
Help on how to write a file in a desired format:
https://www.mathworks.com/examples/matlab/mw/matlab-ex07445498-export-cell-array-to-text-file
  6 Kommentare
Ced
Ced am 22 Mär. 2016
Why does it make sense?
Can you be a bit more specific about what is not clear? I will try and rephrase his comment:
You have different steps:
1. Find the files --> use 'dir'
2. Read the files --> use 'fopen'
3. Process the contents --> use 'textscan' or look for certain strings with 'find', 'strcmp', etc.
4. Write the new file --> use 'fprintf'
There are many way of doing things, and you will have to make the decision on what the code should do. I'm afraid there is no way around that.
Also, every function in matlab has a very good documentation with examples, etc. You will see that most answers can be found there.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Data Import and Export finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by