Index in position 1 exceeds array bounds (must not exceed 1)

4 views (last 30 days)
I have 5 layers of data that need to be ploted. I have to read the data then plot but at the end of code i get the same error messege 'Index in position 1 exceeds array bounds (must not exceed 1)'
How can i fix my code?
Data:
x=16.098379 18.232044 18.232044 24.493554 32.596685 42.197170 51.012891 62.863261 72.744015 82.656702 92.303087 98.205810 108.912068 113.443552 118.784530 123.830789 127.994734 133.916459 142.654775 154.263513 164.376285 168.950613 174.023396 179.926335 185.819521 187.981033 190.000000 188.766114 186.956311 182.504604 177.716390 173.822116 168.537679 158.563536 148.618785 139.873742 128.135403 119.100772 109.944751 100.736648 92.087421 82.457737 75.000000 60.589319 47.793840 42.313484 29.281768 21.178637 16.863343 16.098379 17.940262 28.768481 34.762828 18.835502 20.459158 40.090161 44.522046 22.082815 24.174353 48.838781 52.860921 26.537116 28.899878 56.828542 60.796163 31.355620 34.175234 64.452489 68.056901 36.994848 39.814462 71.645536 75.113671 42.634076 45.657549 78.581806 82.003566 48.827609 52.121759 85.291640 88.579714 55.437307 58.752855 91.747631 94.664626 62.068403 65.674185 97.680807 100.928152 69.281810 72.889435 104.175497 107.422159 76.497059 80.749168 110.463875 113.439589 85.041468 89.455664 116.352782 119.415656 93.857172 98.073073 122.536758 125.495362 102.286850 106.331647 128.685319 131.993286 110.376444 113.986112 135.432328 138.890598 117.439605 120.896374 142.361471 145.856242 124.388560 127.880746 149.351013 152.843585 131.276360 134.574450 156.244916 159.646247 137.872540 141.170630 163.029425 166.070301 144.165826 147.141144 169.033560 171.932303 150.116462 153.393613 174.502612 176.988795 156.671000 159.948387 179.469562 181.942905 163.771378 167.614236 184.379118 185.903029 171.678618 176.491325 187.231006 188.439255 182.433769
y=97.577168 91.320093 91.320093 81.834112 74.310748 68.494931 65.478972 62.874147 62.207944 62.187975 63.082441 65.000000 66.237778 67.327693 69.077103 70.000000 71.232246 71.716362 71.741885 71.565429 71.888680 72.991390 74.705037 78.726636 82.815421 87.581957 94.110920 98.352804 102.780412 108.492991 111.600467 114.750948 116.766909 118.469626 117.488318 115.000000 113.976605 114.102451 114.053738 116.343458 119.014923 122.604867 125.000000 125.992991 125.000000 124.119537 118.960280 112.418224 103.945954 97.577168 97.825474 79.070449 74.687934 102.274873 105.462618 71.460723 69.784473 108.650363 111.027713 68.307669 67.341119 112.935287 114.842862 66.468998 65.596877 116.589392 117.705677 65.263934 65.020909 118.821963 119.938248 64.805211 64.798225 121.054533 121.817725 64.791238 64.864577 122.327020 122.621384 65.169465 65.474354 122.878687 123.135989 65.987362 66.934977 123.393292 123.147894 67.710798 68.086232 122.899305 122.650716 68.461666 68.838281 122.402126 121.037257 69.569876 70.415788 119.602776 117.957165 71.369990 72.064935 116.333530 115.031375 72.659029 73.534576 113.732898 112.727105 74.009408 74.279843 111.721311 111.469183 74.323247 74.333348 111.487556 111.500257 74.321619 74.268498 111.451614 111.402970 74.215376 74.166065 111.521594 111.809135 74.274787 74.383509 112.096675 112.384216 74.523673 75.256721 113.196384 114.042983 76.124205 77.103435 114.889581 115.213389 78.651529 80.345334 115.536788 115.860187 82.048520 83.764564 115.238573 114.582546 85.544919 88.905428 113.542831 111.206978 92.605305 96.512557 106.914362
z=10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000
179.926335 185.819521 187.981033 190.000000 188.766114 186.956311 182.504604 177.716390 173.822116 168.537679 158.563536 148.618785 139.873742 128.135403 119.100772 109.944751 100.736648 92.087421 82.457737 75.000000 60.589319 47.793840 42.313484 29.281768 21.178637 16.863343 16.098379 18.232044 18.232044 24.493554 32.596685 42.197170 51.012891 62.863261 72.744015 82.656702 92.303087 98.205810 108.912068 113.443552 118.784530 123.830789 127.994734 133.916459 142.654775 154.263513 164.376285 168.950613 174.023396 179.926335 181.540483 188.123723 186.891276 175.828987 171.450280 185.454989 183.465127 167.361231 163.649359 181.475264 179.080724 160.120126 156.590893 176.560812 174.177898 153.134593 149.700628 171.714435 168.875598 146.266662 142.818841 165.925884 162.772576 139.348888 135.878935 159.619269 156.367404 132.265320 128.500592 152.694028 149.020652 124.396228 120.523170 145.119809 140.974761 116.275784 112.175340 137.014971 133.367259 108.327221 104.615356 129.719548 126.104473 100.903491 96.817771 122.668008 119.231543 92.730838 89.070796 115.774947 112.300172 85.410753 81.882161 108.825397 105.747378 78.422084 74.962007 102.718168 99.688957 71.601603 68.267297 96.735762 93.795909 64.932991 61.814521 90.856056 87.997338 58.740531 55.666540 85.146779 82.296220 52.592550 49.695119 79.407633 76.485381 46.802385 43.909651 73.563130 70.240411 41.319208 38.752731 66.908850 63.577289 36.186253 33.677615 60.245728 56.721543 31.422402 29.167189 53.094951 49.468360 26.911975 24.898230 45.817875 41.999606 23.050380 21.202531 37.717923 33.227411 19.469363 18.183078 28.736900 22.673310 18.094714
78.726636 82.815421 87.581957 94.110920 98.352804 102.780412 108.492991 111.600467 114.750948 116.766909 118.469626 117.488318 115.000000 113.976605 114.102451 114.053738 116.343458 119.014923 122.604867 125.000000 125.992991 125.000000 124.119537 118.960280 112.418224 103.945954 97.577168 91.320093 91.320093 81.834112 74.310748 68.494931 65.478972 62.874147 62.207944 62.187975 63.082441 65.000000 66.237778 67.327693 69.077103 70.000000 71.232246 71.716362 71.741885 71.565429 71.888680 72.991390 74.705037 78.726636 81.403910 92.806417 96.671754 77.511309 75.927166 100.184033 102.737490 74.844725 74.415573 105.290948 107.143483 74.302763 74.189952 108.778866 110.651538 74.203466 74.255663 112.384696 113.467685 74.307860 74.336059 114.358631 114.896942 74.325924 74.315789 115.435253 115.802858 74.056825 73.536123 115.440384 115.077910 72.427157 71.718823 114.321452 113.142019 70.362135 69.259957 112.283461 111.965439 68.594820 68.165681 111.647417 111.385924 67.736543 66.659868 111.433792 111.481659 65.581092 65.241713 111.494661 111.476174 64.902334 64.790633 111.457687 112.126400 64.797604 64.804574 112.879655 113.632909 64.984183 65.208996 114.517824 115.425849 65.433810 66.032461 116.333874 117.382429 66.708153 67.383846 118.445117 119.507805 68.059538 69.041040 120.504624 121.443136 70.030678 71.020315 122.381649 122.626531 72.533538 74.088268 122.856098 123.085664 75.642998 77.297910 123.315231 123.211164 79.391766 81.485622 122.929723 122.648282 83.579478 86.091568 122.325456 121.712021 88.890999 91.690430 120.295928 118.518134 94.688495 98.460585 116.740341 112.237895 104.307534
20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000 20.000000
16.098379 18.232044 18.232044 24.493554 32.596685 42.197170 51.012891 62.863261 72.744015 82.656702 92.303087 98.205810 108.912068 113.443552 118.784530 123.830789 127.994734 133.916459 142.654775 154.263513 164.376285 168.950613 174.023396 179.926335 185.819521 187.981033 190.000000 188.766114 186.956311 182.504604 177.716390 173.822116 168.537679 158.563536 148.618785 139.873742 128.135403 119.100772 109.944751 100.736648 92.087421 82.457737 75.000000 60.589319 47.793840 42.313484 29.281768 21.178637 16.863343 16.098379 17.940262 28.768481 34.762828 18.835502 20.459158 40.090161 44.522046 22.082815 24.174353 48.838781 52.860921 26.537116 28.899878 56.828542 60.796163 31.355620 34.175234 64.452489 68.056901 36.994848 39.814462 71.645536 75.113671 42.634076 45.657549 78.581806 82.003566 48.827609 52.121759 85.291640 88.579714 55.437307 58.752855 91.747631 94.664626 62.068403 65.674185 97.680807 100.928152 69.281810 72.889435 104.175497 107.422159 76.497059 80.749168 110.463875 113.439589 85.041468 89.455664 116.352782 119.415656 93.857172 98.073073 122.536758 125.495362 102.286850 106.331647 128.685319 131.993286 110.376444 113.986112 135.432328 138.890598 117.439605 120.896374 142.361471 145.856242 124.388560 127.880746 149.351013 152.843585 131.276360 134.574450 156.244916 159.646247 137.872540 141.170630 163.029425 166.070301 144.165826 147.141144 169.033560 171.932303 150.116462 153.393613 174.502612 176.988795 156.671000 159.948387 179.469562 181.942905 163.771378 167.614236 184.379118 185.903029 171.678618 176.491325 187.231006 188.439255 182.433769
97.577168 91.320093 91.320093 81.834112 74.310748 68.494931 65.478972 62.874147 62.207944 62.187975 63.082441 65.000000 66.237778 67.327693 69.077103 70.000000 71.232246 71.716362 71.741885 71.565429 71.888680 72.991390 74.705037 78.726636 82.815421 87.581957 94.110920 98.352804 102.780412 108.492991 111.600467 114.750948 116.766909 118.469626 117.488318 115.000000 113.976605 114.102451 114.053738 116.343458 119.014923 122.604867 125.000000 125.992991 125.000000 124.119537 118.960280 112.418224 103.945954 97.577168 97.825474 79.070449 74.687934 102.274873 105.462618 71.460723 69.784473 108.650363 111.027713 68.307669 67.341119 112.935287 114.842862 66.468998 65.596877 116.589392 117.705677 65.263934 65.020909 118.821963 119.938248 64.805211 64.798225 121.054533 121.817725 64.791238 64.864577 122.327020 122.621384 65.169465 65.474354 122.878687 123.135989 65.987362 66.934977 123.393292 123.147894 67.710798 68.086232 122.899305 122.650716 68.461666 68.838281 122.402126 121.037257 69.569876 70.415788 119.602776 117.957165 71.369990 72.064935 116.333530 115.031375 72.659029 73.534576 113.732898 112.727105 74.009408 74.279843 111.721311 111.469183 74.323247 74.333348 111.487556 111.500257 74.321619 74.268498 111.451614 111.402970 74.215376 74.166065 111.521594 111.809135 74.274787 74.383509 112.096675 112.384216 74.523673 75.256721 113.196384 114.042983 76.124205 77.103435 114.889581 115.213389 78.651529 80.345334 115.536788 115.860187 82.048520 83.764564 115.238573 114.582546 85.544919 88.905428 113.542831 111.206978 92.605305 96.512557 106.914362
30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000 30.000000
179.926335 185.819521 187.981033 190.000000 188.766114 186.956311 182.504604 177.716390 173.822116 168.537679 158.563536 148.618785 139.873742 128.135403 119.100772 109.944751 100.736648 92.087421 82.457737 75.000000 60.589319 47.793840 42.313484 29.281768 21.178637 16.863343 16.098379 18.232044 18.232044 24.493554 32.596685 42.197170 51.012891 62.863261 72.744015 82.656702 92.303087 98.205810 108.912068 113.443552 118.784530 123.830789 127.994734 133.916459 142.654775 154.263513 164.376285 168.950613 174.023396 179.926335 181.540483 188.123723 186.891276 175.828987 171.450280 185.454989 183.465127 167.361231 163.649359 181.475264 179.080724 160.120126 156.590893 176.560812 174.177898 153.134593 149.700628 171.714435 168.875598 146.266662 142.818841 165.925884 162.772576 139.348888 135.878935 159.619269 156.367404 132.265320 128.500592 152.694028 149.020652 124.396228 120.523170 145.119809 140.974761 116.275784 112.175340 137.014971 133.367259 108.327221 104.615356 129.719548 126.104473 100.903491 96.817771 122.668008 119.231543 92.730838 89.070796 115.774947 112.300172 85.410753 81.882161 108.825397 105.747378 78.422084 74.962007 102.718168 99.688957 71.601603 68.267297 96.735762 93.795909 64.932991 61.814521 90.856056 87.997338 58.740531 55.666540 85.146779 82.296220 52.592550 49.695119 79.407633 76.485381 46.802385 43.909651 73.563130 70.240411 41.319208 38.752731 66.908850 63.577289 36.186253 33.677615 60.245728 56.721543 31.422402 29.167189 53.094951 49.468360 26.911975 24.898230 45.817875 41.999606 23.050380 21.202531 37.717923 33.227411 19.469363 18.183078 28.736900 22.673310 18.094714
78.726636 82.815421 87.581957 94.110920 98.352804 102.780412 108.492991 111.600467 114.750948 116.766909 118.469626 117.488318 115.000000 113.976605 114.102451 114.053738 116.343458 119.014923 122.604867 125.000000 125.992991 125.000000 124.119537 118.960280 112.418224 103.945954 97.577168 91.320093 91.320093 81.834112 74.310748 68.494931 65.478972 62.874147 62.207944 62.187975 63.082441 65.000000 66.237778 67.327693 69.077103 70.000000 71.232246 71.716362 71.741885 71.565429 71.888680 72.991390 74.705037 78.726636 81.403910 92.806417 96.671754 77.511309 75.927166 100.184033 102.737490 74.844725 74.415573 105.290948 107.143483 74.302763 74.189952 108.778866 110.651538 74.203466 74.255663 112.384696 113.467685 74.307860 74.336059 114.358631 114.896942 74.325924 74.315789 115.435253 115.802858 74.056825 73.536123 115.440384 115.077910 72.427157 71.718823 114.321452 113.142019 70.362135 69.259957 112.283461 111.965439 68.594820 68.165681 111.647417 111.385924 67.736543 66.659868 111.433792 111.481659 65.581092 65.241713 111.494661 111.476174 64.902334 64.790633 111.457687 112.126400 64.797604 64.804574 112.879655 113.632909 64.984183 65.208996 114.517824 115.425849 65.433810 66.032461 116.333874 117.382429 66.708153 67.383846 118.445117 119.507805 68.059538 69.041040 120.504624 121.443136 70.030678 71.020315 122.381649 122.626531 72.533538 74.088268 122.856098 123.085664 75.642998 77.297910 123.315231 123.211164 79.391766 81.485622 122.929723 122.648282 83.579478 86.091568 122.325456 121.712021 88.890999 91.690430 120.295928 118.518134 94.688495 98.460585 116.740341 112.237895 104.307534
40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000 40.000000
16.098379 18.232044 18.232044 24.493554 32.596685 42.197170 51.012891 62.863261 72.744015 82.656702 92.303087 98.205810 108.912068 113.443552 118.784530 123.830789 127.994734 133.916459 142.654775 154.263513 164.376285 168.950613 174.023396 179.926335 185.819521 187.981033 190.000000 188.766114 186.956311 182.504604 177.716390 173.822116 168.537679 158.563536 148.618785 139.873742 128.135403 119.100772 109.944751 100.736648 92.087421 82.457737 75.000000 60.589319 47.793840 42.313484 29.281768 21.178637 16.863343 16.098379 17.940262 28.768481 34.762828 18.835502 20.459158 40.090161 44.522046 22.082815 24.174353 48.838781 52.860921 26.537116 28.899878 56.828542 60.796163 31.355620 34.175234 64.452489 68.056901 36.994848 39.814462 71.645536 75.113671 42.634076 45.657549 78.581806 82.003566 48.827609 52.121759 85.291640 88.579714 55.437307 58.752855 91.747631 94.664626 62.068403 65.674185 97.680807 100.928152 69.281810 72.889435 104.175497 107.422159 76.497059 80.749168 110.463875 113.439589 85.041468 89.455664 116.352782 119.415656 93.857172 98.073073 122.536758 125.495362 102.286850 106.331647 128.685319 131.993286 110.376444 113.986112 135.432328 138.890598 117.439605 120.896374 142.361471 145.856242 124.388560 127.880746 149.351013 152.843585 131.276360 134.574450 156.244916 159.646247 137.872540 141.170630 163.029425 166.070301 144.165826 147.141144 169.033560 171.932303 150.116462 153.393613 174.502612 176.988795 156.671000 159.948387 179.469562 181.942905 163.771378 167.614236 184.379118 185.903029 171.678618 176.491325 187.231006 188.439255 182.433769
97.577168 91.320093 91.320093 81.834112 74.310748 68.494931 65.478972 62.874147 62.207944 62.187975 63.082441 65.000000 66.237778 67.327693 69.077103 70.000000 71.232246 71.716362 71.741885 71.565429 71.888680 72.991390 74.705037 78.726636 82.815421 87.581957 94.110920 98.352804 102.780412 108.492991 111.600467 114.750948 116.766909 118.469626 117.488318 115.000000 113.976605 114.102451 114.053738 116.343458 119.014923 122.604867 125.000000 125.992991 125.000000 124.119537 118.960280 112.418224 103.945954 97.577168 97.825474 79.070449 74.687934 102.274873 105.462618 71.460723 69.784473 108.650363 111.027713 68.307669 67.341119 112.935287 114.842862 66.468998 65.596877 116.589392 117.705677 65.263934 65.020909 118.821963 119.938248 64.805211 64.798225 121.054533 121.817725 64.791238 64.864577 122.327020 122.621384 65.169465 65.474354 122.878687 123.135989 65.987362 66.934977 123.393292 123.147894 67.710798 68.086232 122.899305 122.650716 68.461666 68.838281 122.402126 121.037257 69.569876 70.415788 119.602776 117.957165 71.369990 72.064935 116.333530 115.031375 72.659029 73.534576 113.732898 112.727105 74.009408 74.279843 111.721311 111.469183 74.323247 74.333348 111.487556 111.500257 74.321619 74.268498 111.451614 111.402970 74.215376 74.166065 111.521594 111.809135 74.274787 74.383509 112.096675 112.384216 74.523673 75.256721 113.196384 114.042983 76.124205 77.103435 114.889581 115.213389 78.651529 80.345334 115.536788 115.860187 82.048520 83.764564 115.238573 114.582546 85.544919 88.905428 113.542831 111.206978 92.605305 96.512557 106.914362
50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000 50.000000
Code:
figure(1)
clf
fp=fopen('shoesolelayers.txt','r');
nlayers=1;
for l=1:nlayers
sline=fgetl(fp);
[xpts,pnts]=sscanf(sline,'%f');
sline=fgetl(fp);
[ypts,pnts]=sscanf(sline,'%f');
sline=fgetl(fp);
[zpts,pnts]=sscanf(sline,'%f');
sline=fgetl(fp);
scanvecs(l)={[xpts;ypts;zpts]};
end
fclose(fp);
% PLOTS FIRST LAYER IN FIGURE(1) WINDOW
layl=scanvecs(l);
plot(layl(1,:),layl(2,:),'b');
After reading data, the result data becomes a 1X1 cell with dimensions 450x1. In order to plot, should the dimensions be 150x3 for a 3-D plot.

Accepted Answer

Spencer Chen
Spencer Chen on 16 Jan 2020
Try instead:
layl=scanvecs{l};
Note the curly brackets to extracting the content of the cell at the indexed position.
Using round backets give you back data still wrapped inside a cell.
Blessings,
Spencer
  5 Comments
Adam Danz
Adam Danz on 16 Jan 2020
ahhh, right. For some reason I thought the indexing error was coming from 'l' in scanvecs(l) but not i see the following line.

Sign in to comment.

More Answers (1)

Guillaume
Guillaume on 16 Jan 2020
First, is your text file read properly. If I paste your data into a new text file, your code fails to read anything. It's much better if you attach an actual example file rather than pasting its content. That way we're sure we'got a file formatted properly.
Second, it's not clear why you have scanvecs(1) = ... What is the purpose of the indexing here?
With that code, indeed scanvecs(1), which is probably the exact same thing as scanvecs is a 1x1 cell array. So layl is also a 1x1 cell array, a cell array with 1 row and 1 column also known as a scalar. Therefore layl(1, :) which asks for all the columns (which is just 1) and the 1st row of this 1x1 cell array, is the same as layl, which is the same as scanvecs(1). On the other layl(2, :) which asks for all the columns (which is just 1) and the 2nd row of a 1x1 cell array is indeed an error.
Assuming that all these cell arrays are just red-herring, perhaps this would work:
for ..
%...I'm assuming your reading code works. Although it's not clear why you create a pnts variable that is never used
%...
scanvec = [xpts; ypts; zpts] %store the whole lot in a matrix. No need for a cell array
end
plot(scanvec(1, :), scanvec(2, :), 'b');

Categories

Find more on Line Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!