MATLAB plotyy y grid not showing up? - matlab
The y grid is not showing up.
I am sorry for pasting my data here, but the randomly generated data won't reproduce the error.
MWE
x = 1:188;
y1 = [2.28625413745400e-06 2.75754117520236e-06 7.28685404437484e-06 0.000162724777360761 0.000221525521386474 0.00513896494125896 0.00604630901473093 0.0239972210208572 0.0299094578291452 0.0379598701078280 0.0407471655008175 0.0424981277377004 0.0593685291574623 0.0720049840827008 0.0764805090392905 0.0784745326633472 0.0860462823212269 0.0872332599512308 0.0975548852352724 0.109523883880442 0.110064605012806 0.113809401352047 0.124266280105196 0.127737254184620 0.131994354266289 0.136382231740752 0.140780372613597 0.148025152077524 0.153450613217859 0.160350058677122 0.162287760596164 0.167560245835870 0.172287619094450 0.179483652830590 0.182889254147371 0.186973131314099 0.191625297613997 0.196138973204891 0.207290820972041 0.228336575919158 0.230665358213673 0.235638857454267 0.235734235774472 0.238705757714335 0.239622986776577 0.242413675960620 0.246310296615708 0.253736977688068 0.263526753327344 0.267765132710984 0.278657792038674 0.279655691920331 0.288031520555191 0.293324147563905 0.296311756729307 0.299954886375481 0.321017342659284 0.326834183424333 0.330097266880667 0.335595881759988 0.336496847040177 0.340794306395668 0.341629365670475 0.346388406232711 0.349275143228649 0.354280512324743 0.354379434267694 0.358138289571028 0.362194170593214 0.362900354379436 0.369051901571130 0.377532832423029 0.378473844107997 0.381395220201511 0.382513829911048 0.384054832987647 0.386163845331814 0.392189611831563 0.394741141959399 0.397482463354943 0.405159848615709 0.405380894697897 0.407164071630765 0.409960356496890 0.410899112960204 0.412540848976194 0.413785128363002 0.416497765056847 0.416620870255991 0.423339554321434 0.432715687900691 0.433645605363207 0.438315853796267 0.440811877583745 0.442254706117630 0.444715767486113 0.446534290546266 0.453869137753388 0.460480289492812 0.462635871995806 0.469200485794422 0.477953684933473 0.480327971284933 0.483328013787908 0.485165999667700 0.488810058710477 0.492434498347716 0.495633702966921 0.496950612281433 0.499449682429962 0.500216965521911 0.500846991265055 0.500928755463801 0.509072082345426 0.510390618618367 0.513193477753814 0.516094965483328 0.519766464957800 0.526453403933161 0.531012377098381 0.537398002662492 0.549302962968306 0.551182949653050 0.552379404338828 0.556210298953147 0.556753658102025 0.559775602234047 0.565600556439014 0.575345977188816 0.582325671082393 0.583274992838168 0.590277452190722 0.600455666337237 0.602008898724798 0.603153938447889 0.613158002706088 0.613885424973209 0.616753470151396 0.628020233091089 0.628074985975907 0.628789310134612 0.630860799827951 0.636442699017899 0.636900946176369 0.637731827970055 0.645063295538950 0.651395391970488 0.661823925726547 0.667492404940707 0.668956876509558 0.669721721712489 0.671361974997858 0.671885436140652 0.680929118840636 0.682908071014682 0.686054230901812 0.686999320186044 0.694779340677743 0.696700705717762 0.703712091209040 0.703869695474697 0.709425231090181 0.724246955883888 0.726713348504891 0.728662080945891 0.732212616777790 0.733176807633189 0.763720671816572 0.765840614187905 0.770399497782647 0.770434651768652 0.792235782237051 0.807184100825349 0.810885623037136 0.811134923493633 0.815243002846112 0.841422843749966 0.861314574636162 0.878517027205137 0.892431499196981 0.942320011798269 0.964745715565426 0.977151781479271 0.988013718634144 0.999972717897711 0.999990949120295 0.999997802101236 0.999997876591522];
y2 = [3294.33837529196 2729.78695657567 2310.42151540182 3261.53933401261 3665.60437426496 2581.47975105179 3286.49864759154 2978.24371790368 4481.99722565735 2800.21030230662 2301.25805253203 2863.33415937793 1958.80234681204 2487.66423766389 3829.37164321518 2868.93021805668 2669.26931138609 2653.62428904136 3222.63130681970 2318.46261983033 2338.28118053869 3420.09701187000 2619.37694067421 3639.34394329064 2542.70875166783 2702.39831536651 2510.69621735271 2267.65044087156 2467.31789304366 2062.46609266725 3373.03272133488 2197.75665691969 2826.13630193704 2236.19499536199 2323.13168705560 3066.53020217878 3068.54949312690 3426.80837351058 3314.30473826970 2536.37810854444 2884.52696903199 2276.44108414871 2395.79431323859 2455.23706941821 2556.54900792254 3287.41337734157 3049.78318859226 2137.34736327310 2734.56065425968 2092.28587548994 2220.94669832315 2576.25273881808 2936.79720507286 3252.22901487077 2354.99925954856 3118.56428955851 2739.08882274580 3037.83300416419 2767.32993139568 2651.17282634850 2126.70682501162 2208.11204840368 2463.12421246333 2788.29925791802 2931.86717632459 1672.90126196404 2200.27471694257 2629.79309139237 2871.88047431798 2771.11497975924 3306.15504624950 2615.51614159686 2104.52375632588 2522.81762261438 2553.64540775560 2664.61027658776 3214.62846184114 2681.73004190842 2854.46880173160 2947.77021172908 2843.58809148613 2970.81524997654 2517.75645078039 2665.88205361855 2972.47722717208 2775.93754320540 3230.01088619321 2093.71452074073 2250.27329605820 2456.05859503165 2998.17131690415 2464.61113820404 2014.42482269388 2513.46818136650 2792.53181675715 3174.78812406346 2701.20264878804 2389.85439304729 3289.42797312716 2295.43987736403 2611.53215270973 3740.71494210077 2462.96252295280 3832.67982476584 2645.28910431242 2405.15899417202 2731.28933338260 2855.62677715298 2323.21533050664 2636.33997756180 2503.20033540276 1748.70147375294 3349.86556128063 2497.65649660493 2271.69261389125 2336.03524355220 2473.18519446995 2266.88488232443 2409.51158095881 1734.14451377117 2514.18757679797 1975.25093236641 2958.72678659639 2429.83473700471 2498.28210099667 2055.42730670745 2408.13320127252 2849.86545528969 2079.01473466442 2035.08193677459 2309.55127919543 2846.16370840958 2395.13215085459 2549.68177442072 2765.86512891974 2724.23809140675 2264.77498971179 2439.87393419107 2055.88468587720 3146.12025364587 2648.24057514780 2332.28994336700 2420.02188205959 2748.73933350174 2447.73770315806 2356.97937091099 2381.15677251297 2567.93916714385 2587.53026732683 2667.30106970822 2660.47433323455 2163.50645008963 2309.40075292939 2312.40421976050 2166.40731989119 2082.28556641993 2745.06117055910 3486.90007765939 1987.74834763183 2485.62389820632 2337.31198380922 1901.20002732537 3112.71557200479 2498.59172261308 2984.01432790167 2793.37859308815 2857.77785197779 2571.67750419978 1876.49080511373 2003.31154773529 2517.62947444061 2929.54702726817 3099.39521514734 3849.11548253558 2114.99710879081 2851.38969242251 1770.21298408528 2570.79519973382 2861.78434546229 3136.05338342104 2007.19612886364 1759.16533204181 2521.93259475353 2206.81633306099 2035.72855620751 2017.41126163408 2228.99620986991 2314.02003648875];
[hAx, hLine1, hLine2] = plotyy(x, y1, x, y2);
hAx(1).XGrid = 'on';
hAx(1).YGrid = 'on';
hAx(2).XGrid = 'on';
hAx(2).YGrid = 'on';
Use:
plotyy(x, y1, x, y2);
grid on;
ha = findobj(gcf,'type','axes');
set(ha(1),'ytick',linspace(0,5000,5));
set(ha(2),'ytick',linspace(0,1,5));
you can mess around with the linspace, i just looked at the max values and chose 5 tick marks
Related
How to plot subsets of geographic plots
I'm attempting to plot Antarctic sea ice concentration using a Lambert plot. My script produces a plot, but when I want to plot a certain area (not all of Antarctica), the plot goes haywire. Here's my script: addpath('D:\wass\m_map') % m_proj('lambert','lat',[min(lat(:)) max(lat(:))],... % 'lon',[min(lon(:)) max(lon(:))]) m_proj('lambert','lon',[0 120],'lat',[-80 -50]); m_pcolor(lon,lat,ice_conc); shading flat; % Add a coastline and axis values. m_coast('patch',[.7 .7 .7]) m_grid('box','fancy') % Add a colorbar colorbar DATA: lat: -62.128365 -62.243603 -62.358810 -62.473976 -62.589111 -62.704208 -62.819267 -62.934296 -63.049286 -63.164238 -63.279160 -62.113903 -62.229088 -62.344234 -62.459347 -62.574425 -62.689465 -62.804466 -62.919434 -63.034367 -63.149261 -63.264122 -62.098972 -62.214100 -62.329189 -62.444244 -62.559261 -62.674244 -62.789188 -62.904095 -63.018967 -63.133801 -63.248600 -62.083576 -62.198643 -62.313675 -62.428673 -62.543629 -62.658550 -62.773434 -62.888279 -63.003086 -63.117859 -63.232594 -62.067715 -62.182720 -62.297691 -62.412628 -62.527523 -62.642380 -62.757202 -62.871983 -62.986729 -63.101437 -63.216106 -62.051388 -62.166332 -62.281242 -62.396111 -62.510944 -62.625740 -62.740494 -62.855213 -62.969891 -63.084530 -63.199135 -62.034595 -62.149479 -62.264324 -62.379128 -62.493896 -62.608624 -62.723312 -62.837963 -62.952576 -63.067146 -63.181683 -62.017342 -62.132160 -62.246937 -62.361675 -62.476376 -62.591038 -62.705658 -62.820240 -62.934780 -63.049286 -63.163750 -61.999626 -62.114376 -62.229088 -62.343758 -62.458389 -62.572979 -62.687531 -62.802040 -62.916512 -63.030945 -63.145336 -61.981445 -62.096127 -62.210770 -62.325371 -62.439930 -62.554451 -62.668930 -62.783371 -62.897770 -63.012127 -63.126442 -61.962807 -62.077419 -62.191990 -62.306519 -62.421005 -62.535454 -62.649860 -62.764225 -62.878548 -62.992832 -63.107075 lon: 7.0379410 7.0667295 7.0957541 7.1250162 7.1545200 7.1842675 7.2142620 7.2445068 7.2750049 7.3057594 7.3367739 7.2700686 7.2997870 7.3297477 7.3599544 7.3904090 7.4211159 7.4520774 7.4832969 7.5147777 7.5465226 7.5785356 7.5019569 7.5326014 7.5634961 7.5946436 7.6260471 7.6577096 7.6896348 7.7218256 7.7542858 7.7870178 7.8200259 7.7335982 7.7651658 7.7969913 7.8290763 7.8614254 7.8940411 7.9269266 7.9600859 7.9935217 8.0272379 8.0612373 7.9649854 7.9974732 8.0302258 8.0632458 8.0965376 8.1301022 8.1639452 8.1980686 8.2324772 8.2671738 8.3021612 8.1961117 8.2295170 8.2631931 8.2971449 8.3313751 8.3658857 8.4006824 8.4357672 8.4711447 8.5068178 8.5427895 8.4269686 8.4612885 8.4958858 8.5307655 8.5659304 8.6013851 8.6371317 8.6731739 8.7095165 8.7461624 8.7831154 8.6575518 8.6927814 8.7282963 8.7641010 8.8001976 8.8365908 8.8732843 8.9102812 8.9475851 8.9851999 9.0231295 8.8878517 8.9239883 8.9604177 8.9971437 9.0341692 9.0714979 9.1091337 9.1470804 9.1853418 9.2239227 9.2628250 9.1178627 9.1549034 9.1922426 9.2298861 9.2678366 9.3060970 9.3446722 9.3835649 9.4227810 9.4623222 9.5021944 9.3475780 9.3855181 9.4237652 9.4623222 9.5011930 9.5403814 9.5798922 9.6197281 9.6598930 9.7003918 9.7412281 ice_conc: 87.1799980513752 89.0399980098009 90.2999979816377 91.1299979630858 90.7499979715794 91.6499979514629 91.1699979621917 91.1799979619682 89.6499979961664 86.2899980712682 86.7199980616570 87.1999980509281 89.7599979937077 90.4399979785085 90.2799979820848 90.3399979807437 91.1999979615212 90.1599979847670 88.4699980225414 89.1099980082363 86.7199980616570 86.4899980667979 86.8699980583042 88.9499980118126 90.3699979800731 90.2999979816377 88.9999980106950 88.9399980120361 89.1399980075657 88.5199980214238 88.2399980276823 86.2299980726093 86.2799980714917 86.3299980703741 88.0099980328232 88.0599980317056 87.2799980491400 88.3499980252236 88.1699980292469 88.8699980136007 87.7999980375171 85.9699980784208 85.9699980784208 86.0299980770797 85.3499980922788 86.5599980652332 86.3699980694801 87.4099980462343 87.1399980522692 86.9499980565161 86.5099980663508 86.0199980773032 85.6299980860204 85.3199980929494 85.1499980967492 83.8599981255829 85.7199980840087 86.1799980737269 85.7899980824441 86.1099980752915 86.4599980674684 85.7799980826676 85.4599980898202 84.4199981130660 84.2099981177598 83.6599981300533 83.2699981387705 83.9299981240183 85.1999980956316 85.6399980857968 85.7799980826676 84.7999981045723 84.2599981166422 83.4699981343001 83.3599981367588 83.1799981407821 82.3999981582165 82.2099981624633 82.6799981519580 84.4099981132895 84.0999981202185 83.7199981287122 83.7799981273711 82.9999981448054 82.6099981535226 81.8799981698394 81.9599981680512 81.6699981745333 82.9399981461465 82.1599981635809 83.6599981300533 85.5099980887026 85.6899980846793 84.7699981052429 82.3699981588870 81.9499981682748 81.6099981758744 80.7599981948733 81.0299981888384 81.1899981852621 82.4899981562048 85.8299980815500 85.4799980893731 84.9399981014431 85.0699980985373 83.0799981430173 82.0899981651455 81.2599981836975 79.9599982127547 78.8099982384592 81.5299981776625 81.9499981682748 84.5999981090426 84.8699981030077 85.5799980871379 84.1099981199950 83.5099981334060 82.1499981638044 80.6599981971085 79.4499982241541 79.6899982187897
Matlab generate a heatmap on sphere
I have points that are all part of a spherical surface. How can I create a 3D sphere where the color of the sphere is determined by the density of the points (smoothed). An example of data points can be found in the picture below. Using the following code, the points can be colored: x = data(:,1); y = data(:,2); z = data(:,3); D = [x(:), y(:), z(:)]; N = numel(x); %// calculation of color vector [n,m] = ndgrid(1:N,1:N); %// euclidian distance of each point to every other point X = arrayfun(#(a,b) sum( (D(a,:) - D(b,:)).^2 ), n, m); %// threshold factor T = 1; %// sort distances of points Y = sort(X,2); %// calculate average distance of the closest T% of all points Z = mean(Y(:,2:ceil(N*T)),2); %// plot colormap jet; scatter3(x,y,z,20,-Z,'filled'); title('T = 0.01') Now, I want to color a sphere according to the data. The following figure is for random data. [x,y,z] = sphere; surf(x,y,z,rand(length(x))); colormap jet shading interp Sample of my data: -0.636016480755703 0.617525876796302 -0.0928047432418846 -0.973951523685005 1.33968621140501 -0.484260283616615 -1.09449677739217 1.95314823996034 -0.997620228061477 -1.27650273224044 2.30054644808743 -1.52076502732240 -1.34107124912069 2.50643151442066 -1.93523263993568 -1.41743718592965 2.64326633165829 -2.38693467336683 -1.52722674072605 2.66172386431264 -2.68924816504662 -1.78737177571955 2.53918932377253 -2.86176675629917 -2.13798636181308 2.25411151223426 -2.71760930605696 -2.63246062794664 1.72971210753335 -2.72474671481593 -3.03187531422826 1.12946204122675 -3.07732528909000 -3.24477552244776 0.394710528947106 -3.67518248175182 2.78947368421053 1.11300309597523 -4.46904024767802 2.49650108417110 1.17716341415336 -4.93987778434851 2.52268839923534 0.940134822416742 -5.07883086829661 2.87130058385343 0.507398832293135 -4.76887457217636 3.04415584415584 0.461038961038961 -4.41298701298701 3.09087249672940 0.653567475093087 -4.11894938110094 3.11987397479496 0.702540508101620 -3.94573914782957 3.17966101694915 0.719840478564307 -3.52233300099701 3.12836149155253 0.840997700689793 -2.86519044286714 2.97330943133154 0.892490787770142 -2.26048202370282 2.81690697215090 0.873000197511357 -1.86114951609718 2.72014039944631 0.816195372750643 -1.64094324698438 2.50647023691021 0.872387019709337 -1.35715707744376 2.23888664376642 0.836886239644373 -1.02939987876339 1.96850235730765 0.814575183067509 -0.776808105125891 1.64841095342794 1.11333200079952 -0.690885468718768 1.36944528036914 1.18331828668874 -0.567609589728157 0.920234429323533 0.813251216847125 -0.225489222211184 0.570574643359454 0.388738195700221 -0.0264215390797675 0.316863696069516 -0.0561281196322118 0.0646660604223506 0.338646811912852 -0.391515090945433 0.0651609034579250 0.479434319290907 -0.676526242406135 0.0231052683995618 0.505991285403050 -0.746187363834423 0.00925925925925952 0.399658325796402 -0.813636820420058 0.0130640136669684 0.182226660009985 -0.957613579630554 0.00439340988517190 -0.0248032672576950 -1.24863034166750 -0.0676860245044320 -0.283441074092491 -1.72710094480358 -0.272948781700647 -0.527511004401761 -2.34133653461385 -0.705782312925170 -0.797852242219350 -2.97176096251367 -1.49487918862484 -0.922330097087379 -3.29166249624662 -2.23876488839956 -0.898067487734055 -3.46104936417343 -3.16261139481326 -0.727430211839240 -3.46159176400713 -3.78058800237577 -0.614893829129698 -3.34522978765826 -4.33002691655867 -0.453940686573228 -3.06104001625025 -4.98694901482836 -0.173647905628312 -2.72118364490653 -5.48340497850645 0.0242345666699911 -2.38655629799541 -5.81115986835544 0.198836859520706 -2.10383034192319 -6.01564223403189 0.380042037834051 -1.79871884696227 -6.17951156040436 0.423617429986857 -1.63856030735012 -6.25290668284299 0.368721000605205 -1.66920516441396 -6.24581400040347 0.0171154038634771 -1.99409468521670 -6.09303373035732 -0.396368687369779 -2.45550153785098 -5.72055759499951 -0.911024174942322 -3.02593038419099 -4.85911325107834 -1.22442557442557 -3.29275724275724 -3.85614385614386 -1.22364472894579 -3.30446089217844 -2.70414082816563 -1.09318766066838 -3.01586909234724 -1.74006327862369 -0.846371252649642 -2.61244574543252 -1.05284142525487 -0.594202898550724 -2.24637681159420 -0.644927536231885 -0.493466023321271 -2.07438681141938 -0.501708886208283 -0.414079822616408 -1.88802660753880 -0.374168514412417 -0.0486402719456110 -1.25204959008198 -0.0690361927614474 0.514052222443692 -0.238489136934423 0.0455451465018948 1.25832163625426 0.215410066172047 -0.196310407058352 1.72030784508441 0.633813306852036 -0.532571996027806 2.33757173956066 1.28933306946368 -1.43583019988126 2.66762105686156 1.66294956801286 -2.65888085191883 2.82720953326713 1.42879841112215 -3.80993048659384 2.70761349939735 1.02732020891924 -4.72047006830052 2.42173094081491 0.500297412511153 -5.41731932189947 1.64370927318296 -0.734636591478697 -6.11152882205514 1.19525675811476 -1.17174153351422 -6.22434931162697 1.11648548917922 -1.26179315847213 -6.22569063528473 1.11648548917922 -1.26179315847213 -6.22569063528473 1.29463307776561 -1.04600219058050 -6.21905805038335 1.69427680547174 -0.494216455441561 -6.11265338966003 2.19971642697995 0.369252582540004 -5.67956248734049 2.63406087304766 1.03103724469363 -4.84551461754105 2.90801393728223 1.36689895470383 -3.48257839721254 2.69187842551071 1.30109616342800 -2.03637269556552 2.04063692987744 0.843078159533856 -0.848754269640346 1.28362077559565 0.0458578406938491 -0.185724254810089 0.722807017543860 -0.518245614035088 -0.00491228070175431 0.548188515490968 -0.832172772227268 -0.0118579069532743 0.489908530522967 -1.08401272618811 -0.0579140982302633 0.485282298573438 -1.30887080570625 -0.124573035965441 0.674118231495281 -1.33253849975161 -0.168007948335817 0.910319782104308 -1.33229093110057 -0.229244426510643 1.52194752774975 -1.40302724520686 -0.515186680121089 1.94507084414289 -1.55647575334265 -0.876222310915985 2.35918818446699 -1.89234401687933 -1.55827388727017 2.71365858525392 -2.06993913997805 -2.58001596328445 2.86434225027552 -1.95721871555956 -3.17287846909127 2.85724240915879 -1.92110502737680 -3.66057740169238 2.87056949422541 -1.78156113102350 -3.98426921545201 2.87284396309667 -1.61111111111111 -4.25952667468913 2.80383257690368 -1.63519919314170 -4.40963187090267 2.74593029062219 -1.74528113452512 -4.41146509537601 2.79961927662559 -1.78649433924456 -4.21245366195772 2.90093495126318 -1.80893176845037 -3.77849612094689 2.92225456735595 -1.85735796024895 -3.29276249749046 2.79813695871098 -1.99234642497482 -2.74043303121853 2.69918862065511 -1.87313432835821 -2.15235901031754 2.52209558088382 -1.58498300339932 -1.52319536092781 2.00474364150182 -1.47204279370206 -0.880904319741623 1.51878192927978 -1.62576379845738 -0.618351197034960 1.23150095123661 -1.63627716030840 -0.477520777010114 0.531772406847935 -1.78439073514602 -0.336606243705942 0.0184244597151679 -1.70859476147794 -0.250473060452145 -0.761328398519556 -1.39836951085326 -0.212463739121736 -1.14685385314615 -1.00161599838400 -0.209473790526209 -1.46421063169486 -0.401441585744319 -0.256982680949045 -1.65316831683168 0.183663366336634 -0.385742574257425 -1.74656382873529 0.675961633540987 -0.563532087412242 -1.89565826330532 0.973389355742297 -0.793417366946779 -2.13232939763858 1.09455673404042 -1.06588953372023 -2.22335431025872 1.24398162021776 -1.26261112775946 -2.25349301397206 1.26686626746507 -1.31457085828343 -2.32195949316572 1.27616482091190 -1.40491868701985 -2.32195949316572 1.27616482091190 -1.40491868701985 -2.25349301397206 1.26686626746507 -1.31457085828343 -1.94300518134715 1.07393383818254 -0.884216819449980 -1.58513309894525 0.672978402812657 -0.464239075841286 -1.23895482198065 0.186895382467338 -0.184202652837339 -0.579979879275654 -0.312776659959758 0.0340040241448691 0.0370258577321662 -0.908441493107959 0.0195693731763762 0.0376980148385803 -1.41537998796872 -0.125025065169440 -0.218357293656379 -1.75379511410476 -0.280838443751885 -0.596396934408281 -2.03976311336717 -0.499353040708669 -0.921337706221428 -2.33015305108328 -0.810922281852514 -1.15569341604963 -2.61947168300981 -1.20672403442065 -1.34566968781470 -2.98257804632427 -1.89088620342397 -1.47722515698196 -3.13345958337486 -2.45724110435563 -1.56538309245694 -3.18704216986735 -3.03009305088101 -1.66732830488289 -3.12643906312029 -3.51667328304883 -1.69259886442873 -3.09971112660624 -3.62316963841020 -1.71797696544817 -3.10520781171758 -3.39609414121182 -1.73907022749753 -3.08506429277943 -2.99891196834817 -1.55176565008026 -3.07383627608347 -2.38804173354735 -1.29407651583258 -2.96668664469084 -1.81125761662172 -1.06947201270345 -2.71119491861850 -1.26915442635967 -0.663021769522668 -2.13655881765528 -0.580487317755142 -0.209927507047926 -1.41683447442610 -0.132400322190898 0.163531402408679 -0.794366477555489 0.0366278491091858 0.418277331747448 -0.462037863019130 0.0522846664684309 0.586739327883742 -0.290644868301544 0.0331516802906444 0.652918908149034 -0.108686989440127 0.0178322374975086 0.687443901466042 0.142016555300688 -0.00982347661314398 0.774385999801134 0.549766331908124 -0.105846673958437 0.841714797849034 0.982473610834495 -0.267128062139017 0.827499243417734 1.33965499848684 -0.436951477857360 0.812180194642320 1.71977525835256 -0.683806561653456 0.701562344511892 1.92168374962683 -0.817593790426909 0.435846429281878 2.00925004973145 -0.835289437039984 0.0682452642073778 2.07342971086740 -0.857926221335992 -0.307490144546649 2.10891539472354 -0.912059031638532 -0.719540461553966 2.05698881386677 -0.951073264133830 -1.10075818036712 2.00598563447726 -1.05367118914605 -1.56707560343108 1.90325154598045 -1.24182126471175 -1.69690374913443 1.87555643486003 -1.31931941834009 -1.91472868217054 1.74031007751938 -1.37984496124031 -2.14285714285714 1.58571428571429 -1.47142857142857 -2.36444466520962 1.38793959864892 -1.56134512219352 -2.58613043040016 0.984326176796694 -1.54314081241810 -2.78857029467209 0.479015775374541 -1.57148526639548 -2.87015945330296 -0.105922551252847 -1.55694760820046 -2.83612343686971 -1.03781766841468 -1.68132311415894 -2.71839481555334 -1.49127617148554 -1.76859421734796 -2.48778316351766 -1.82011079236324 -1.67815807696112 -2.17667773417849 -2.01398531039340 -1.44018512928866 -1.81555333998006 -2.16919242273180 -1.21395812562313 -1.31528822055138 -2.21709273182957 -0.899348370927319 -0.798962386511025 -2.21465629053178 -0.675745784695200 -0.261611611611612 -2.25895895895896 -0.600350350350350 0.208694338101954 -2.17585129961717 -0.534757203304453 0.449437082793664 -1.88831324100827 -0.379645312344326 1.00702458605118 -1.46929252383342 -0.313296537882589 1.28716658278812 -1.08983392048314 -0.289783593356819 1.57556687643592 -0.714613924682849 -0.347118170012986 1.68775020016013 -0.484787830264211 -0.382706164931946 1.61437908496732 -0.599346405228758 -0.352287581699347 1.57417582417582 -0.575274725274726 -0.327472527472528 1.78015328761597 -0.188987494957644 -0.430012101653893 2.06253743262128 0.340786584148532 -0.696196845677780 2.25189017111023 0.728014325507362 -0.992240350179069 2.30490383647165 0.963548484543349 -1.16680092639211 2.16848971399900 1.16432513798294 -1.14706472654290 1.52051204515674 1.44758592883782 -0.814585223263785 0.938315894369706 1.52640757349278 -0.587493771798705 0.270871327254306 1.42152988855117 -0.376393110435664 -0.431318681318681 1.27967032967033 -0.317582417582417 -1.24290141971606 1.11672665466907 -0.472905418916217 -1.67691236446832 0.878344772704665 -0.596737292350543 -2.09241823587711 0.562239841427156 -0.782804757185331 -2.46963156309608 0.160676638891678 -1.04607971087240 -2.80539575481055 -0.297758381273557 -1.44653838524102 -3.04411764705882 -0.720588235294118 -1.97058823529412 -3.10657776893223 -0.932530600059707 -2.24584535774704 -3.10657776893223 -0.932530600059707 -2.24584535774704 -3.09186140209508 -0.923851732473811 -2.19580983078163 -3.06973971786211 -0.972282932644546 -2.16371945161931 -2.97409275190349 -1.18797587263918 -2.06679521408089 -2.58697813121272 -1.65029821073559 -1.67783300198807 -2.17490305260018 -1.82484836432336 -1.27145271949886 -1.54121682978509 -1.85420240137221 -0.764806780345071 -0.516422082459818 -1.59888190076869 -0.243535988819008 0.621063189568706 -1.10441323971916 -0.0862587763289868 1.66834120365719 -0.593388927961419 -0.382296794936200 2.25558547775783 -0.621284659884301 -0.821115100738080 2.66296629662966 -0.781178117811781 -1.31313131313131 2.87842586085734 -1.01686577652846 -1.74947294448349 2.96028014007004 -1.22826413206603 -2.06478239119560 2.91112000800721 -1.21779601641477 -1.94089680712641 2.57236973447794 -0.810141744859253 -1.20203633459772 1.39727199516811 -0.142490436883430 -0.223273605798269 -0.231495280675608 -0.227620466964729 0.0772975658221564 -1.18559766176174 -0.862426930054425 -0.193156621648861 -1.58402645555667 -1.20913919230384 -0.475849283495340 -1.75749674054759 -1.35924180122355 -0.641209507571959 -1.79383084577114 -1.39004975124378 -0.679502487562189 -1.71299871299871 -1.39956439956440 -0.629096129096129 -1.11655827913957 -1.16223111555778 -0.242321160580290 -0.445971516781197 -0.933323374165920 -0.0159346678617660 0.420428269830099 -0.767165979692369 0.0181461747260472 1.62276740919125 -0.599237407184427 -0.356963676500100 2.24262721183645 -0.868489453164051 -0.859792062381285 2.62592815572948 -1.10194661850291 -1.37818583182822 2.92154718106791 -1.41344337277518 -2.13826190712936 3.03345724907063 -1.55018587360595 -2.76765799256506 3.09189297524802 -1.50085178875639 -3.27382503256839 3.09373122371320 -1.44131784498298 -3.61686360905267 3.12990756386045 -1.36810456217076 -3.53021568432561 3.24122807017544 -1.02192982456140 -3.09649122807018 3.16491701659668 -0.546140771845631 -2.23975204959008 2.47121620273371 -0.127007881871695 -1.01326948019555 1.11460425873845 -0.123443149859381 -0.108879067898755 -0.332014246141670 -0.423624851602691 0.0643055005935889 -1.35305494941480 -1.01175362031343 -0.298055941281492 -1.85162601626016 -1.81846123339282 -0.961679555819949 -2.02630258006224 -1.98925810661580 -1.25148077502259 -2.06198595787362 -1.93941825476429 -1.24523570712136 -2.02630258006224 -1.98925810661580 -1.25148077502259 -1.88748763600396 -1.92814045499505 -1.07141444114738 -0.928151469855506 -1.61086198305929 -0.349725959142999 -0.0390547263681593 -0.873084577114428 0.0264676616915427 0.855323383084577 -0.356019900497513 -0.0278606965174126 1.91169066559259 -0.262007854193938 -0.516816030611217 2.74024280124411 -0.390037122504264 -1.35356677034213 3.18088116410671 -0.598625707356508 -2.30901374292644 3.27699018538713 -0.869138495092693 -3.19520174482007 3.20708582834331 -1.02165668662675 -3.74411177644711 3.14159113796576 -1.02769385699899 -4.05659617321249 3.13289695527125 -1.02211643360111 -4.09486264008728 3.23694438907714 -0.827287223440303 -3.81029499701017 3.32393239323932 -0.460796079607961 -3.07100710071007 2.90476664344711 -0.0317444521842970 -1.62528609811922 1.52950526524935 -0.148023047883966 -0.287701172263063 0.185110663983903 -0.638430583501006 0.0575452716297797 -1.09335745151241 -1.15500954677922 -0.231635011556627 -1.58385217915244 -1.54348262703354 -0.614982928298855 -1.71489128266507 -1.62602234191103 -0.741871135048873 -1.71489128266507 -1.62602234191103 -0.741871135048873 -1.65856458374925 -1.63770213615492 -0.710620882411659 -1.41790441547944 -1.54981307466909 -0.525108618773366 -1.29696668324217 -1.44157135753357 -0.417503729487817 -1.12397315167301 -1.18648567421358 -0.252554598276898 -0.854046242774566 -1.05780346820809 -0.128612716763007 -0.666666666666667 -1.33333333333333 -0.166666666666667 -0.521618405394685 -1.73125743752479 -0.307417691392304 -0.0915189746670674 -2.03509562431161 -0.433964153399419 1.20271210013908 -1.81606397774687 -0.561891515994436 1.86270346779901 -1.85527246992215 -0.996461429582448 1.86263846928499 -1.97301107754280 -1.08509566968782 1.76366703045937 -2.14922115289215 -1.15061017958131 1.76361819090455 -2.18985507246377 -1.18805597201399 1.68721529015647 -2.17250940780353 -1.10937809467221 1.65447768711595 -2.04371914979349 -0.976176085423593 1.60033760301857 -1.90715916989375 -0.838000198590011 1.44555845197514 -1.94866653298576 -0.770102265891318 1.31015187849720 -2.06075139888090 -0.774180655475619 1.16209202515221 -2.18400039924144 -0.793542269687593 1.04569463823002 -2.24302371935420 -0.788419374127964 0.958153103309526 -2.11618549441706 -0.656875565838447 0.961211161686127 -2.03423708687908 -0.600930140510587 1.00920920920921 -1.94034034034034 -0.557557557557558 1.01808382027000 -1.80727382631473 -0.481714688696353 0.951635560907084 -1.49859522376079 -0.307144290587999 0.803406952560166 -1.35560067346737 -0.207437852827573 0.785593473286240 -1.22505223360860 -0.158541438662819 0.580485838121157 -1.15290797298659 -0.0920270134059069 0.264785894206549 -1.10916876574307 -0.0380352644836268 -0.0502447307961242 -1.05444011587254 -0.0134352212566178 -0.339005104594135 -0.957711940746672 -0.00820738664798304 -0.516057585825028 -0.699889258028793 0.0143964562569212 -0.282254028625763 -0.610899809828846 0.0537984185767195 -0.313627353815659 -0.525173439048563 0.0592170465807742 -0.180463242698892 -0.550251762336354 0.0669687814702917 -0.0783649052841476 -0.817248255234297 0.0358923230309078 -0.0305602716468592 -0.871467092779387 0.0268650754019779 -0.0276997189883579 -0.866118024889603 0.0279004415897233 0.362864321608040 -0.759547738693467 0.0262311557788948 0.767242249823286 -0.540644249217409 -0.0170655356962532 0.732645497345487 -0.599569267755184 -0.0148752879895824 0.702180028129395 -0.490857946554149 0.00175808720112514 0.751281793505580 -0.310244294762240 -0.000854529003719851 0.798241206030151 -0.355075376884422 -0.0132160804020103 0.747126436781609 -0.454022988505747 -0.00574712643678188 0.489324726911619 -0.520953326713009 0.0381827209533263 0.258796481407437 -0.628248700519792 0.0537784886045589 0.217539977873881 -0.714723926380368 0.0457105501357740 0.0984422110552764 -0.856180904522613 0.0283919597989950 -0.154428614127727 -0.990734283152336 -0.00154428614127733 -0.298350228582787 -1.19866825680779 -0.0662890081494729 -0.546631864270656 -1.23100090352374 -0.109326372854132 -0.911847389558233 -1.03815261044177 -0.139959839357430 -1.06025781952633 -0.891775756970121 -0.153392625162387 -0.956119162640902 -0.889291465378422 -0.119162640901771 -0.957903780068729 -0.776632302405498 -0.0987972508591066 -0.983094928478544 -0.673201960588177 -0.0909772931879562 -0.917893375770838 -0.729809031231351 -0.0794708573702003 -0.916733911640105 -0.691194270728263 -0.0735323784547108 -0.849363437437836 -0.799035209866720 -0.0716132882434848 -0.744629833150165 -0.799330602457788 -0.0455090418623234 -0.598454636091725 -0.811714855433699 -0.0171485543369885 -0.481754002187531 -0.860495177488317 -0.00651287660336042
Manually select peaks on a plot with MATLAB
I am finding and plotting local maximas and minimas on a waveform with the function findpeaks. I would like to be able to select some of those peaks with a pointer directly from the plot and get the coordinates into the workspace. Is that possible? Here is a subset of an example dataset: data = [-4.89540984473946e-06 -4.89046450287593e-06 -4.88283149336408e-06 -4.87095198116254e-06 -4.90712807029133e-06 -4.91927636347547e-06 -4.84407526018980e-06 -4.87589730823133e-06 -4.92470545237800e-06 -4.84429026519065e-06 -4.94884075275366e-06 -4.97668505593799e-06 -5.05091858731457e-06 -4.91637367843710e-06 -4.84267768702634e-06 -4.89191584860588e-06 -4.84660167647784e-06 -4.83337832656191e-06 -4.79032179995216e-06 -4.76624025231771e-06 -4.75887604778215e-06 -4.70856280330800e-06 -4.64964899691363e-06 -4.72963414438675e-06 -4.83950621114218e-06 -4.81381203536647e-06 -4.83251825696249e-06 -4.87320964430400e-06 -4.90336533160774e-06 -4.83783986967173e-06 -4.80376018565747e-06 -4.74447010720748e-06 -4.84961187054251e-06 -4.83536719945138e-06 -4.79919111834559e-06 -4.85611601862430e-06 -4.82606784644511e-06 -4.85471844872184e-06 -4.84386025701412e-06 -4.81515589140679e-06 -4.83353956282112e-06 -4.88793805514151e-06 -4.79279444702247e-06 -4.81897238803632e-06 -4.80263134571406e-06 -4.89245337024318e-06 -4.87165078787927e-06 -4.71388435646062e-06 -4.79182688643761e-06 -4.86353400235825e-06 -4.90288153698267e-06 -4.88181018900206e-06 -4.90814939463545e-06 -5.02565445022868e-06 -4.97270728327852e-06 -4.89395845050979e-06 -4.89019572804071e-06 -5.00581942056473e-06 -4.85815866007998e-06 -4.87890749444223e-06 -5.05392877098134e-06 -4.96442924133893e-06 -5.00549688200667e-06 -4.98668317977521e-06 -4.92502796151073e-06 -4.95034584308071e-06 -4.96141905730884e-06 -5.12907611359824e-06 -5.13993428270170e-06 -5.07462383072134e-06 -5.01700012945037e-06 -4.97609373883257e-06 -4.94351913722961e-06 -4.94255157997661e-06 -4.98587686360239e-06 -5.00968963210843e-06 -5.02554690501322e-06 -4.95346351631875e-06 -4.92153396677935e-06 -4.94884073137851e-06 -5.04333930187227e-06 -5.02522438757406e-06 -5.03941530333772e-06 -5.15149128554495e-06 -5.05236989188090e-06 -5.03366368296826e-06 -4.94265906728271e-06 -4.94975453582840e-06 -4.97340605765111e-06 -4.97690002973954e-06 -4.95776378585822e-06 -5.01318362006572e-06 -5.06478693414940e-06 -5.01995653541482e-06 -4.99791762200221e-06 -4.87826241180049e-06 -4.88250895410629e-06 -4.81209190921077e-06 -4.91621236220338e-06 -4.93239215982718e-06 -4.93792876456361e-06 -4.92712431672434e-06 -4.91895378603758e-06 -4.89820494557392e-06 -4.75527449565399e-06 -4.80870541294211e-06 -4.91949131649655e-06 -4.82714288810490e-06 -4.80058867327714e-06 -4.77408822193145e-06 -4.83574342467004e-06 -4.97727628837568e-06 -4.88003626339490e-06 -4.81934860759687e-06 -4.84611783428869e-06 -4.83192693662324e-06 -4.83101311610351e-06 -4.81993989876836e-06 -4.82601401869105e-06 -4.88035875610688e-06 -4.86423272630262e-06 -5.01286106570465e-06 -4.96292411288641e-06 -5.10537080127033e-06 -5.08919099820762e-06 -4.95163586368386e-06 -4.97227720195358e-06 -5.05339117694178e-06 -5.19503154703270e-06 -5.23636796094566e-06 -5.20373960447927e-06 -5.14745972271145e-06 -5.07161360140476e-06 -5.09994166445759e-06 -5.08150423089344e-06 -5.13251627052468e-06 -5.09445880665652e-06 -5.07473128332313e-06 -5.05581009966274e-06 -5.03672760927253e-06 -5.02543936932230e-06 -5.03285734881196e-06 -5.01302231887177e-06 -4.99770257519616e-06 -5.00458300346133e-06 -4.98372665851392e-06 -5.03651257822457e-06 -5.02414929072324e-06 -5.07596763603182e-06 -5.02108534123367e-06 -5.07489254669347e-06 -5.03033093518173e-06 -5.02855705432535e-06 -4.94325033413489e-06 -4.96249408236197e-06 -5.04129663718886e-06 -5.03183602180999e-06 -5.13036612636593e-06 -5.00716318699453e-06 -5.11418632652828e-06 -4.90406407090556e-06 -4.91072949082945e-06 -4.99426235774332e-06 -4.94765810874763e-06 -4.89868871329783e-06 -4.85590093201640e-06 -4.84278510314675e-06 -4.87487593151054e-06 -4.82219753090326e-06 -4.93034948804728e-06 -4.93868128118638e-06 -4.94325032124572e-06 -4.91293336390327e-06 -4.83418454545091e-06 -4.85514840665468e-06 -4.88132633107078e-06 -4.73936344658863e-06 -4.89798991183953e-06 -4.91674987033445e-06 -4.91099825512483e-06 -4.90481661159291e-06 -4.75065167397842e-06 -4.73081662246593e-06 -4.83106683653475e-06 -4.81902605804528e-06 -4.72286113134670e-06 -4.68061089959087e-06 -4.71307799071485e-06 -4.66426985378300e-06 -4.60019573139779e-06 -4.51252383793892e-06 -4.51204005491146e-06 -4.54912995301628e-06 -4.55810677145764e-06 -4.46866099529538e-06 -4.58896123793896e-06 -4.59310026040807e-06 -4.58202705111776e-06 -4.48430326328582e-06 -4.48795850933213e-06 -4.51924300905173e-06 -4.48543207246916e-06 -4.46855349494860e-06 -4.55337646172091e-06 -4.44345063281763e-06 -4.57154513493103e-06 -4.59385281489407e-06 -4.41711142485936e-06 -4.53913178401176e-06 -4.55606412110996e-06 -4.46264060897575e-06 -4.42463692084076e-06 -4.52155441407285e-06 -4.50677221940636e-06 -4.48634589207169e-06 -4.59396031491354e-06 -4.64728375852222e-06 -4.63664057022768e-06 -4.59965820617443e-06 -4.64911136961635e-06 -4.65884073472609e-06 -4.70695008507957e-06 -4.75586573646044e-06 -4.73178420321849e-06 -4.75801590401412e-06 -4.60471101137253e-06 -4.57471658105903e-06 -4.58584353491208e-06 -4.62363222795283e-06 -4.58793992938515e-06 -4.55482781015275e-06 -4.68437364815221e-06 -4.65249784756566e-06 -4.57933937481562e-06 -4.62631990328050e-06 -4.62089081158290e-06 -4.57917812541947e-06 -4.51225507656684e-06 -4.55477405258585e-06 -4.53311141783991e-06 -4.54939872432026e-06 -4.55117257965666e-06 -4.52789733425270e-06 -4.50650345378238e-06 -4.47903543044462e-06 -4.48312069612006e-06 -4.51419020129353e-06 -4.50145062688468e-06 -4.52735977698723e-06 -4.54450714032921e-06 -4.55117256252312e-06 -4.46608084509033e-06 -4.53407896158256e-06 -4.45140614557067e-06 -4.41920781351070e-06 -4.52881111872715e-06 -4.44624582148976e-06 -4.45909289459186e-06 -4.46274812107349e-06 -4.45748027280859e-06 -4.50951361740786e-06 -4.46887600458167e-06 -4.50902983974733e-06 -4.47457387229324e-06 -4.42200300467295e-06 -4.43549511692057e-06 -4.37695759401414e-06 -4.38319299076052e-06 -4.39695388751217e-06 -4.56692232078024e-06 -4.43619390131638e-06 -4.48392698684545e-06 -4.48269064668583e-06 -4.49526895605598e-06 -4.40947842813550e-06 -4.40765081368960e-06 -4.33094463147224e-06 -4.39802895440372e-06 -4.48215311323093e-06 -4.44398817350220e-06 -4.42307806797564e-06 -4.38330048298545e-06 -4.45748025906533e-06 -4.51983429633548e-06 -4.44973978296766e-06 -4.46274812303772e-06 -4.36239041550375e-06 -4.35497242302094e-06 -4.24794928477930e-06 -4.29444601665229e-06 -4.36255164763265e-06 -4.43114106994723e-06 -4.39652385759326e-06 -4.43802152606982e-06 -4.36142284958266e-06 -4.32116148894134e-06 -4.22204010180950e-06 -4.20666662863045e-06 -4.33357855390536e-06 -4.37615130510219e-06 -4.25902249968437e-06 -4.16731909488875e-06 -4.29810127026078e-06 -4.30869069847499e-06 -4.21639599654153e-06 -4.34551183219518e-06 -4.27622361239748e-06 -4.32411793285627e-06 -4.33782507529094e-06 -4.35932646891537e-06 -4.35491868199967e-06 -4.42931346065645e-06 -4.46446822094393e-06 -4.42098166754579e-06 -4.37857017732590e-06 -4.38722450174974e-06 -4.40017908708695e-06 -4.43764524852276e-06 -4.39534127545859e-06 -4.44006415615985e-06 -4.46984357275167e-06 -4.45694274459542e-06 -4.52381204489461e-06 -4.59718551829175e-06 -4.64292971925335e-06 -4.59562668122636e-06 -4.55998814171054e-06 -4.69238290131149e-06 -4.68259978578968e-06 -4.78618271604811e-06 -4.74554508911485e-06 -4.77306687647779e-06 -4.82902422748630e-06 -4.74022349874821e-06 -4.78967667659056e-06 -4.68560999623238e-06 -4.70399367174356e-06 -4.83488333484937e-06 -4.81424200588459e-06 -4.80553395017146e-06 -4.82827164485003e-06 -4.89798988689285e-06 -4.90750427683425e-06 -4.91562106073226e-06 -4.85041811053271e-06 -4.83198067332453e-06 -4.90702049436914e-06 -5.01140971443911e-06 -4.95115207847818e-06 -4.96695560075888e-06 -4.95894634250918e-06 -4.97442733132394e-06 -5.00146533478908e-06 -4.98619934294484e-06 -5.10123174293496e-06 -5.14579337049380e-06 -5.02968589389739e-06 -5.10698337504644e-06 -5.14235315096857e-06 -5.13294629440792e-06 -5.12536706933419e-06 -5.11187493758741e-06 -5.04264047326268e-06 -5.07591387573231e-06 -5.11225121369745e-06 -5.12934481360250e-06 -5.14127807813422e-06 -5.04500564269106e-06 -5.12020673493844e-06 -5.23507787622358e-06 -5.16761728731260e-06 -5.12241062730512e-06 -5.10370441798274e-06 -5.13896668771534e-06 -5.16347825893636e-06 -5.25781558024835e-06 -5.26351346598172e-06 -5.16976743555304e-06 -5.14740596681149e-06 -5.14332071497995e-06 -5.20433089563993e-06 -5.13348383832941e-06 -5.21475907516790e-06 -5.27114645029502e-06 -5.29974328192358e-06 -5.29243281497749e-06 -5.18336704101590e-06 -5.18395833370644e-06 -5.19659038991682e-06 -5.22938000548113e-06 -5.15821043730756e-06 -5.18094815047183e-06 -5.27109269003538e-06 -5.21121133937498e-06 -5.15466270877798e-06 -5.22427343410753e-06 -5.13552647587313e-06 -5.09585642010333e-06 -5.02425678371832e-06 -5.08773962439909e-06 -5.11273501095427e-06 -5.09085734648637e-06 -5.13472017070403e-06 -5.11026234651260e-06 -4.93830501777556e-06 -4.90132261051010e-06 -4.98695189641788e-06 -5.11074611982211e-06 -5.12391570943425e-06 -4.99458489423704e-06 -4.95819380936770e-06 -4.89487222615777e-06 -4.84273136321247e-06 -4.92911319316957e-06 -4.97044959434856e-06 -5.06478691361076e-06 -4.95066831680678e-06 -4.95932263243045e-06 -4.89304460217765e-06 -4.90718177731852e-06 -4.95448481663433e-06 -4.98480176798481e-06 -5.01522623575681e-06 -4.96674060947798e-06 -4.89132449101996e-06 -4.88998066549326e-06 -4.97308351915836e-06 -4.98173782509740e-06 -4.94244403930944e-06 -4.86971560265590e-06 -5.02646069264862e-06 -5.00512057189556e-06 -5.05828274361789e-06 -5.01850518922777e-06 -4.98619935583612e-06 -5.01823641196971e-06 -4.95486109073768e-06 -4.96496672723791e-06 -4.95136708846810e-06 -5.01393612496185e-06 -5.11461636982289e-06 -5.14229939099664e-06 -5.16627342760414e-06 -5.13149494555811e-06 -5.22309085185195e-06 -5.20900744562811e-06 -5.10085549026536e-06 -5.12719468332557e-06 -5.16960616961794e-06 -5.22631606661904e-06 -5.17938930219621e-06 -5.22362839337094e-06 -5.26270715341434e-06 -5.28920762120520e-06 -5.28479983942088e-06 -5.34172474221797e-06 -5.22717612139269e-06 -5.20314832822807e-06 -5.24013070017282e-06 -5.43799718960251e-06 -5.43412693551289e-06 -5.45858475339959e-06 -5.50492025712232e-06 -5.48481646690506e-06 -5.42197866239572e-06 -5.42353752087345e-06 -5.43600832255097e-06 -5.52658289608058e-06 -5.51690727283137e-06 -5.41617329020160e-06 -5.41515197559490e-06 -5.52873305121873e-06 -5.53002313061791e-06 -5.42267746815339e-06 -5.33978963365147e-06 -5.44245873969728e-06 -5.45138180379219e-06 -5.49997492391736e-06 -5.48589151941974e-06 -5.50212507459059e-06 -5.49427706897414e-06 -5.41294808602362e-06 -5.47320572027297e-06 -5.53480718404686e-06 -5.57582106855960e-06 -5.51615472885835e-06 -5.47497957994393e-06 -5.58028260548941e-06 -5.59968761060948e-06 -5.48556900608788e-06 -5.45277938759969e-06 -5.58205645126603e-06 -5.60253653948927e-06 -5.66655691880590e-06 -5.73536135294201e-06 -5.62634933045323e-06 -5.66661064980999e-06 -5.71434373612397e-06 -5.76299062783483e-06 -5.71434373874723e-06 -5.70235670500012e-06 -5.50787667035274e-06 -5.46277751425852e-06 -5.43772839801462e-06 -5.49228815542689e-06 -5.61296470280075e-06 -5.68424178318152e-06 -5.70343176567384e-06 -5.70740951854130e-06 -5.64140027568978e-06 -5.64983958052105e-06 -5.54808427913237e-06 -5.58888314248457e-06 -5.69805642928122e-06 -5.63000454665461e-06 -5.66021399927151e-06 -5.75186364900393e-06 -5.59538731929230e-06 -5.57603607368943e-06 -5.51475710522887e-06 -5.46992672665820e-06 -5.42203239891019e-06 -5.54211762875043e-06 -5.56582290556767e-06 -5.41988225341455e-06 -5.40923906089805e-06 -5.47949483705825e-06 -5.51271447930229e-06 -5.55770612593648e-06 -5.55362086525713e-06 -5.42934286632973e-06 -5.40214361208860e-06 -5.48917046629352e-06 -5.50965055040005e-06 -5.47433453479784e-06 -5.47707595957126e-06 -5.49132061153509e-06 -5.40993786088237e-06 -5.41332432036094e-06 -5.29431416253087e-06 -5.27603798331231e-06 -5.29839942415794e-06 -5.34156346257886e-06 -5.24228081786113e-06 -5.42654768330477e-06 -5.34215474508166e-06 -5.41687204660465e-06 -5.47632337748322e-06 -5.48153746558058e-06 -5.45068299949198e-06 -5.39633825335762e-06 -5.38612509951272e-06 -5.35844205100384e-06 -5.32538366340842e-06 -5.41020661741338e-06 -5.46353006578526e-06 -5.39762831694138e-06 -5.43170802282690e-06 -5.48750412420699e-06 -5.58592669808638e-06 -5.47266815048819e-06 -5.48422516113002e-06 -5.55517972822541e-06 -5.60221399654449e-06 -5.53330205540489e-06 -5.61941509905129e-06 -5.63973390081090e-06 -5.64484049731144e-06 -5.50051243706660e-06 -5.51163939563723e-06 -5.64742063527922e-06 -5.67209347237735e-06 -5.65935390806408e-06 -5.69321858724285e-06 -5.75600263829014e-06 -5.60199897405416e-06 -5.67392109252045e-06 -5.72627696597894e-06 -5.73917781511763e-06 -5.60646052156519e-06 -5.66037523413921e-06 -5.78691089727002e-06 -5.87200260678621e-06 -5.91328528246058e-06 -5.87151883828506e-06 -5.83856795714906e-06 -5.92817497437017e-06 -5.93548546080599e-06 -5.87463653247661e-06 -5.95171899243511e-06 -5.90527599552075e-06 -5.89038629121416e-06 -6.00176343514282e-06 -6.02229725693547e-06 -5.94650491219471e-06 -5.89452530534357e-06 -5.97262907333676e-06 -6.02057716567032e-06 -6.04498124095891e-06 -6.03208041594050e-06 -5.94682742660133e-06 -5.94021573897517e-06 -5.93887191530283e-06 -5.94102205038252e-06 -6.02122223213133e-06 -6.04460497129116e-06 -5.98079960094166e-06 -5.98638996177472e-06 -5.97160775038871e-06 -5.93978570037840e-06 -5.92365965538281e-06 -5.99300163095193e-06 -5.98380978432889e-06 -5.92790620375100e-06 -5.99461424769442e-06 -5.93419534918941e-06 -6.02165222926862e-06 -6.01299793575300e-06 -5.93811936362023e-06 -5.90828615975766e-06 -5.93360404113511e-06 -6.02901645418901e-06 -6.03584313832001e-06 -5.93795810062678e-06 -5.98472359793705e-06 -5.96961887017841e-06 -5.88667726268544e-06 -5.80368192148849e-06 -5.96730746492287e-06 -5.93822686062853e-06 -5.87082001436852e-06 -5.76428063705576e-06 -5.87092750557774e-06 -5.89780422693046e-06 -5.87452896794551e-06 -5.84560961592563e-06 -5.86383203687022e-06 -5.86883110040176e-06 -5.79900536909068e-06 -5.62871440880852e-06 -5.70730194727375e-06 -5.75465876148963e-06 -5.74019908689073e-06 -5.68365044479493e-06 -5.67375979188971e-06 -5.55292201665917e-06 -5.51669217414419e-06 -5.55990995613614e-06 -5.52545400363319e-06 -5.62414535693739e-06 -5.63699243407591e-06 -5.61366342725965e-06 -5.52647532400086e-06 -5.56791923235924e-06 -5.47643083322858e-06 -5.51421952363263e-06 -5.57850864807533e-06 -5.47385065725829e-06 -5.43380433448031e-06 -5.39440303078793e-06 -5.41144287840893e-06 -5.38660877189569e-06 -5.41380802976399e-06 -5.48384879665080e-06 -5.41638820914534e-06 -5.38671629078859e-06 -5.40730386648816e-06 -5.30447349745795e-06 -5.43719078711484e-06 -5.51502580678293e-06 -5.48771904289687e-06 -5.53082931059948e-06 -5.46616389569207e-06 -5.40246604300234e-06 -5.37757819159447e-06 -5.40472368411455e-06 -5.45261803233513e-06 -5.50153368259830e-06 -5.53996739725791e-06 -5.51868103201207e-06 -5.48573016045100e-06 -5.49051420912711e-06 -5.51776721149034e-06 -5.44364119736049e-06 -5.49637334843401e-06 -5.53265693099902e-06 -5.38429736696079e-06 -5.44557630521909e-06 -5.41886085768137e-06 -5.38236222899405e-06 -5.54227879254047e-06 -5.46600263042054e-06 -5.33393037886201e-06 -5.38112591902652e-06 -5.53620465056360e-06 -5.53953737157883e-06 -5.60194514620983e-06 -5.62382279330292e-06 -5.52174497885962e-06 -5.51626211712965e-06 -5.53529083301262e-06 -5.63322963991197e-06 -5.54071991641543e-06 -5.58560406969271e-06 -5.63355217003026e-06 -5.68746687557798e-06 -5.72557809683548e-06 -5.74681070721292e-06 -5.64758181411515e-06 -5.58587283921792e-06 -5.59103316279369e-06 -5.59452712927172e-06 -5.60603037701969e-06 -5.71982645180166e-06 -5.76116286029805e-06 -5.56189878136957e-06 -5.51217684179510e-06 -5.60495531357065e-06 -5.54496644009520e-06 -5.48212863528228e-06 -5.50255496359689e-06 -5.54034364085478e-06 -5.45089788056670e-06 -5.40579871851138e-06 -5.38687753161319e-06 -5.41493683351232e-06 -5.37870699108488e-06 -5.41278667278869e-06 -5.41622688537485e-06 -5.40789511160194e-06 -5.40655128493490e-06 -5.28942248836993e-06 -5.28802488676584e-06 -5.38639371567867e-06 -5.32817871775360e-06 -5.37413793933207e-06 -5.49314810275190e-06 -5.60027874194595e-06 -5.51416569761865e-06 -5.49717959556793e-06 -5.49830841283345e-06 -5.52615270040722e-06 -5.47696830588858e-06 -5.47578572834985e-06 -5.52685149816945e-06 -5.52830283605021e-06 -5.48046225678601e-06 -5.50406003821635e-06 -5.48132234015409e-06 -5.47626951443504e-06 -5.49879219744894e-06 -5.51094047971048e-06 -5.46111102002430e-06 -5.40735755043941e-06 -5.34258462523545e-06 -5.37618055541577e-06 -5.31216017130203e-06 -5.33242524377630e-06 -5.31866435529325e-06 -5.29350775144891e-06 -5.23615280476852e-06 -5.22927234832385e-06 -5.16546699306750e-06 -5.05258472615354e-06 -5.11477747260567e-06 -5.05064959284116e-06 -5.04629556415876e-06 -4.99367090607053e-06 -4.99195080382841e-06 -5.00802308521128e-06 -4.94948558628495e-06 -4.90954674975368e-06 -5.04043642972469e-06 -5.02199898248048e-06 -5.00205645122296e-06 -5.17057355603148e-06 -5.03188963268342e-06 -5.00490538855339e-06 -4.96502032574281e-06 -4.97372837921458e-06 -4.95727982838450e-06 -4.93362828929532e-06 -4.97888870877928e-06 -5.00555042632034e-06 -4.97792113779404e-06 -4.89793598556043e-06 -4.94717416063484e-06 -5.00538917849674e-06 -4.92266259450500e-06 -4.92148001217477e-06 -4.96383773060392e-06 -4.84783775858551e-06 -4.78327985632729e-06 -4.84267743862670e-06 -4.88928168484461e-06 -4.91642718735649e-06 -4.74748006614417e-06 -4.84181737893114e-06 -4.81752080739420e-06 -4.67174142447862e-06 -4.73726688321590e-06 -4.79139662959378e-06 -4.82171360391750e-06 -4.83284057642901e-06 -4.84751526526804e-06 -4.87423073209731e-06 -4.85805093797883e-06 -4.75419925031973e-06 -4.85901850328573e-06 -4.91680347130784e-06 -4.88702405057843e-06 -5.09010462494739e-06 -5.22943359438442e-06 -5.19755778815083e-06 -5.12165789218515e-06 -5.06349664591349e-06 -5.07892390279114e-06 -5.15794149654972e-06 -5.15084602720091e-06 -5.21733906443099e-06 -5.26329827367789e-06 -5.24475333813980e-06 -5.24991366982997e-06 -5.27507028143886e-06 -5.25593406205597e-06 -5.38698498660486e-06 -5.33828435751415e-06 -5.36064579501660e-06 -5.28625100220416e-06 -5.30909623196335e-06 -5.36155962445233e-06 -5.37048268528820e-06 -5.39983206064599e-06 -5.35403411039474e-06 -5.39950954893382e-06 -5.47508692543759e-06 -5.37967452378114e-06 -5.46170229426191e-06 -5.52717401615887e-06 -5.56716659578404e-06 -5.45777829252873e-06 -5.36446228660623e-06 -5.38768378185095e-06 -5.39311288226295e-06 -5.36634366191503e-06 -5.36182836931477e-06 -5.31124636241299e-06 -5.34328344474290e-06 -5.42127969859080e-06 -5.42832139675068e-06 -5.35763559895865e-06 -5.33210270749199e-06 -5.35575422844336e-06 -5.29528158619511e-06 -5.31769678958663e-06 -5.34602484810977e-06 -5.30888121573785e-06 -5.29893681843310e-06 -5.19788030754737e-06 -5.22104804554750e-06 -5.12880710066183e-06 -5.09795261449947e-06 -5.16810087623664e-06 -5.20223431856199e-06 -5.09064212910719e-06 -5.02087015275136e-06 -4.96851428050948e-06 -4.85364312718931e-06 -4.83300179394795e-06 -4.89718342050124e-06 -4.92508148640287e-06 -4.85676082430702e-06 -4.83794711619449e-06 -4.86294246280772e-06 -4.89460325754852e-06 -4.70802499026627e-06 -4.76382106350249e-06 -4.83284052123499e-06 -4.90298879405879e-06 -4.91798601239289e-06 -4.85235303418556e-06 -4.87261808551720e-06 -4.76091841079235e-06 -4.79585815232190e-06 -4.86466258024554e-06 -4.86460882068290e-06 -4.78951523683887e-06 -4.75199532056575e-06 -4.71931322898312e-06 -4.79327798466120e-06 -4.71619551789174e-06 -4.80789892524642e-06 -4.68243834487953e-06 -4.68781369752333e-06 -4.72484981960907e-06 -4.74946890673868e-06 -4.66029190898965e-06 -4.52725210708961e-06 -4.49456999970155e-06 -4.54611956179680e-06 ] prominence_factor_localp2p = 0.0000004; figure; subplot(2,1,1) findpeaks (data,'MinPeakProminence', prominence_factor_localp2p); subplot(2,1,2) findpeaks (-data,'MinPeakProminence', prominence_factor_localp2p);
Try [x,y] = ginput(1) % Returns x and y after one mouse click if you want to get one peak or: [X,Y] = ginput() % Returns X=[x1..xN] and Y=[y1..yN] after N clicks, stop with ENTER if you want to get multiple peaks in vector format
Unfortunately, I don't have the Signal Processing Toolbox (findpeaks is part of the SPT) so I'll answer this without it. Say you have a function: x = sin(linspace(0, 2*pi, 1000)) + 0.1*rand(1, 1000); plot(linspace(0, 2*pi, 1000),x); This gives be the following plot: Now, using the function "Data Cursor" , you can select a point on the plot by clicking at it. You can drag the data tip around if you didn't hit the correct point at the first try. If you right click on the frame that comes up, you can export the [x,y] values to the workspace: This gives the following variable (struct) in the workspace: peak_value_1 peak_value_1 = Target: [1x1 Line] Position: [1.5849 1.0984] DataIndex: 253 Now you have the positions of the maximum point: position = peak_value_1.Position position = 1.5849 1.0984 How you want to proceed from here is your call. Note that you can create multiple data tips by holding the Shift button while clicking.
Normalize each column in matrix colormap MATLAB
I'm using MATLAB to plot a colormap of the following data matrix: 1010.89914200000 1006.07847500000 1013.91775300000 1016.37012500000 1012.64447500000 1005.15384200000 998.323644400000 1007.09643600000 1010.39007800000 1010.71070000000 1007.75920300000 1003.43986900000 1001.77407500000 1000.93290600000 1009.19935000000 1010.79651100000 1006.15733600000 1001.08001400000 1006.62765600000 1008.98760600000 1012.59690300000 1014.13669400000 1012.41850000000 1002.83265600000 1010.20939200000 1006.22354400000 1014.13985000000 1016.01628600000 1012.16700600000 1004.47184200000 1000.64279200000 1006.93063300000 1009.98950000000 1010.53409400000 1007.46695300000 1003.07056100000 1001.31949400000 1001.61572800000 1009.12864700000 1010.45935000000 1006.24603900000 1001.40907500000 1006.31782500000 1009.00493300000 1012.13883300000 1013.93106700000 1011.88797800000 1003.01553600000 1009.70062500000 1006.35064700000 1014.37573900000 1015.70891100000 1011.51357800000 1003.79413100000 1001.69951400000 1006.79389200000 1009.72253100000 1010.41560600000 1007.01026100000 1002.91738300000 1000.86708100000 1002.11736400000 1009.09675300000 1009.98591400000 1005.46058600000 1000.94756700000 1006.18716400000 1008.73213100000 1012.14396700000 1013.51734400000 1010.97627200000 1003.29271400000 1009.45768300000 1006.17825800000 1014.67340300000 1015.64428600000 1011.30645600000 1003.37367500000 1001.93843600000 1006.59857800000 1009.45626700000 1010.25717800000 1006.66668100000 1003.00867800000 1001.13924400000 1002.74437200000 1009.14411900000 1009.62172200000 1005.50861100000 1000.11247800000 1006.11126700000 1008.63767200000 1012.11852500000 1013.46424200000 1010.52458300000 1003.95781100000 1009.26808100000 1006.29626900000 1014.67797500000 1015.67235600000 1011.20240600000 1003.14341400000 1000.42042500000 1006.97025800000 1009.47529700000 1010.42883100000 1006.41034400000 1003.31582500000 1001.22851700000 1003.87331700000 1009.01971100000 1009.26751700000 1004.97643300000 1000.38995600000 1006.25921900000 1008.81359400000 1012.25596700000 1013.53560600000 1010.21200300000 1004.63438300000 1009.71863900000 1006.81711100000 1014.88478900000 1016.09375300000 1011.26197200000 1003.11559200000 1000.71963300000 1007.50932500000 1009.46868300000 1010.70578900000 1006.41695000000 1003.87943100000 1001.47584700000 1004.88967200000 1009.38281100000 1009.50196100000 1005.06519200000 1001.66275800000 1006.49482200000 1009.35829200000 1012.54210000000 1013.92888300000 1009.72913100000 1005.35431100000 1010.74544400000 1007.71330600000 1015.30482800000 1016.41307200000 1011.40723900000 1003.05097800000 1001.88330600000 1007.78023100000 1009.79253600000 1011.11156400000 1006.55320300000 1004.49287800000 1001.40507500000 1005.91256700000 1009.88450300000 1009.38280000000 1004.75816700000 1003.58816900000 1006.68395600000 1009.83212800000 1012.71196100000 1014.27383300000 1009.46791900000 1005.91156100000 1011.06202800000 1008.61448600000 1016.07176900000 1016.77051900000 1011.43023100000 1002.91816900000 1003.01835800000 1008.37585300000 1010.16145800000 1011.46680800000 1006.80956900000 1004.88291700000 1001.64883900000 1006.73743100000 1010.37819200000 1009.44031900000 1005.11520300000 1004.70793600000 1007.29316900000 1010.53632800000 1013.30822200000 1014.53464700000 1009.54564700000 1006.43934700000 1011.16811700000 1009.12379400000 1016.69230000000 1017.09807500000 1011.42089200000 1002.90685800000 1003.45940000000 1008.64450600000 1010.42875300000 1011.61208900000 1006.92791100000 1004.99500600000 1001.85114700000 1007.48185600000 1010.74164700000 1009.37652200000 1005.22774400000 1005.74404200000 1008.04547500000 1011.20978900000 1013.70315600000 1014.90081400000 1009.46251700000 1007.25164700000 1010.77128100000 1009.35747200000 1016.79156100000 1016.94504400000 1011.34709700000 1002.68326400000 1004.21865300000 1008.90464200000 1010.65171700000 1011.66855800000 1006.76375000000 1004.84766700000 1001.64799400000 1007.95280800000 1011.15295600000 1008.96945800000 1004.99150800000 1006.73475300000 1008.30754700000 1011.69105600000 1014.00060300000 1015.01862800000 1009.08597500000 1007.85208300000 1010.13805300000 1009.61241400000 1016.74593600000 1016.61859700000 1011.07230300000 1002.35865300000 1004.26001400000 1008.88295800000 1010.48621700000 1011.41217200000 1006.14741900000 1004.82872800000 1001.26854200000 1008.04161100000 1011.11477800000 1008.65341400000 1004.63091100000 1007.43303300000 1008.40434700000 1011.74642800000 1014.01016900000 1014.80443600000 1008.33869400000 1007.93218300000 1009.50911900000 1009.62698100000 1016.46591900000 1015.96478900000 1010.07972200000 1001.85613100000 1004.44510800000 1008.68885000000 1009.90488600000 1010.78808600000 1005.41067200000 1004.68175000000 1000.73121900000 1007.96492200000 1011.01123900000 1008.22990300000 1003.85685000000 1007.24613600000 1008.27287800000 1012.14434200000 1013.92860000000 1014.61665800000 1007.55034400000 1008.09293300000 1008.70381100000 1009.61384700000 1015.81295800000 1015.06458300000 1008.88961700000 1000.62531700000 1004.21893300000 1008.20705000000 1009.58456400000 1010.16761700000 1004.43428100000 1004.27616900000 1000.27990000000 1007.68135000000 1010.75977200000 1007.51076700000 1002.70041700000 1006.61412500000 1008.12120300000 1012.10416700000 1013.70059700000 1014.09623100000 1006.09171400000 1008.05956900000 1008.02154700000 1009.64861100000 1015.14255300000 1014.23098600000 1008.14283900000 999.389411100000 1004.11294400000 1008.03047200000 1009.17975600000 1009.66578900000 1003.65600000000 1003.73793600000 999.649786100000 1007.55710300000 1010.73914200000 1006.48525600000 1001.60153900000 1006.51005600000 1007.86194700000 1011.76237200000 1013.33892200000 1013.76143300000 1004.98931400000 1007.96544700000 1007.77482500000 1009.85345300000 1014.92648900000 1013.59322500000 1007.68484400000 998.743208300000 1004.23994200000 1008.15078900000 1009.14176900000 1009.13383600000 1003.04438300000 1003.35990600000 999.229216700000 1007.35725800000 1010.77036400000 1006.11508100000 1001.06650600000 1006.27331900000 1008.08580600000 1011.76860000000 1013.18307200000 1013.39113600000 1003.78306100000 1007.80175600000 1007.69477800000 1010.25384700000 1014.99210800000 1013.30303900000 1007.45265800000 998.250572200000 1004.45173600000 1008.31279400000 1009.06058100000 1008.82283300000 1002.55153300000 1003.10945300000 999.019630600000 1007.24711700000 1010.81812500000 1006.09366700000 1000.98814200000 1006.25510800000 1008.09595800000 1011.79827200000 1013.07516400000 1013.10823300000 1003.03183900000 1008.06458600000 1007.77405000000 1010.73199400000 1015.15546900000 1013.15583900000 1007.25787500000 997.884352800000 1004.75770600000 1008.85976700000 1009.25861700000 1008.55503600000 1002.43732200000 1002.93201900000 998.928380600000 1007.53712200000 1010.76891400000 1006.20278600000 1000.95717200000 1006.24851400000 1008.26927500000 1011.92516700000 1013.04778600000 1012.83340000000 1002.36345600000 1008.45907200000 1008.10153900000 1011.22165600000 1015.49348900000 1013.28646400000 1007.37516700000 997.841966700000 1005.30818900000 1009.36494400000 1009.81374200000 1008.59688100000 1002.46048900000 1003.12547200000 998.873250000000 1008.09001100000 1010.74253600000 1006.00015800000 1001.09626700000 1006.44443300000 1008.61596400000 1012.13335000000 1013.32301100000 1012.72540800000 1001.82905800000 1008.71992200000 1008.42932800000 1012.08600000000 1015.93560300000 1013.55619200000 1007.18396400000 997.877988900000 1005.97368300000 1009.70238900000 1010.35090600000 1008.72040000000 1002.82235000000 1003.50095000000 998.968997200000 1008.71467200000 1011.18516100000 1006.09722800000 1001.00105000000 1006.51150600000 1008.80134200000 1012.38964200000 1013.64155000000 1012.74316400000 1001.41934400000 1008.87543300000 1008.61755800000 1012.61210000000 1016.07700000000 1013.93586700000 1007.27577800000 997.712516700000 1006.77127200000 1010.00605300000 1010.65426700000 1008.88601400000 1003.20735600000 1003.72689700000 999.271758300000 1009.20620300000 1011.16123600000 1006.69687200000 1000.70609700000 1006.79953300000 1009.01541700000 1012.91482800000 1014.02131100000 1012.95065300000 1001.67870000000 1009.32203600000 1008.56708100000 1012.99515000000 1016.33867800000 1013.68418100000 1007.24658600000 997.281041700000 1007.01185000000 1010.30151400000 1010.94030600000 1008.70953300000 1003.34373100000 1004.04526700000 999.558302800000 1009.36840300000 1011.30540300000 1006.56111700000 1000.80576400000 1007.06003900000 1009.30639400000 1013.20931400000 1014.27723600000 1013.05665800000 1001.85187500000 1009.70395300000 1008.29791700000 1013.28623100000 1016.51517200000 1014.03927800000 1006.84327200000 997.159275000000 1007.09736400000 1010.48451100000 1010.96097800000 1008.46591400000 1003.29630300000 1003.91275300000 1000.09343100000 1009.50430800000 1011.42889700000 1006.72751400000 1000.51083900000 1007.10306100000 1009.37503100000 1013.39047200000 1014.59432200000 1013.03755800000 1002.26636900000 1010.06034200000 1008.21371700000 1013.59691400000 1016.65878900000 1013.99910800000 1006.30900300000 997.142713900000 1007.04279200000 1010.75180300000 1011.00974400000 1008.16542800000 1003.24316900000 1003.42274700000 1000.31632800000 1009.49489200000 1011.19880800000 1007.23048900000 1000.05682200000 1007.13264700000 1009.40641100000 1013.34435800000 1014.59523900000 1012.99997500000 1002.45651400000 1010.21388600000 1007.63143900000 1013.69220800000 1016.52085600000 1013.28099200000 1005.84439200000 997.479972200000 1007.22611700000 1010.59871900000 1010.82017800000 1007.92970300000 1003.35441900000 1002.36780800000 1000.54393300000 1009.14068600000 1011.02388300000 1007.05475600000 1000.35642800000 1006.99240300000 1009.16368100000 1013.13141400000 1014.49421400000 1012.86652200000 1002.60169400000 1010.12598900000 using: imagesc(data) Now I need to normalize each column separately in the following way: finding the maximum value of each column and set it's color, and finding the lowest value of each column and set it's color as well. So in the end I need a colormap which have the same color for every local maximum and minimum of a column. I'm quite new to plotting, so I tried looking for normalized colormaps here and on the web, but didn't find anything that can help me.
You're not going to be able to do this strictly with a colormap because the colormap is applied globally to the image and the color used for the local max in one column would be applied to all elements with that value regardless of whether they were the local max of their respective column. Instead, you can normalize each column of your data and then display that. %// Subtract off the minimum of each column D = bsxfun(#minus, data, min(data, [], 1)); %// Divide by the maximum D = bsxfun(#rdivide, D, max(D, [], 1)); %// Display the result imagesc(D);
how to read a multiple folders then read single text file and remove header and footer
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 so that 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 I try this code. But idea where i am doing mistake? years = dir; years(1:2) = []; for yy = 1:length(years) months = dir; months(1:2) = []; for mm = 1:length(months) file = dir('*.txt'); 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) = []; fid = fopen(sprintf('New Text Document.txt',k),'wt'); % Here i am trying to export fprintf(fid,' \t \t \n'); fprintf(fid,'%.3f\t%.3f\t%.3f\n',Data); % not sure what is going here? fclose(fid); end end
Your immediate issue is that you read all of your data in as strings and not numbers. This means that when writing your data back out you want to use strings rather than numbers. Currently you try to write Data back to the file with: fprintf(fid,'%.3f\t%.3f\t%.3f\n',Data); % not sure what is going here? But the %f indicates that you think that Data contains numeric data. Instead you will want to use the following format string. fprintf(fid, '%s\n', Data) This will write it back just like you read it in (as a string). Addendum As far as going through the directory tree and finding all of these files, you have to be careful because it looks like you are calling dir from within the same directory multiple times. You will probably want something like this: basedir = 'E:\meta data\new\data _thesis\NCEP\potential_temperature'; % 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); for k = 1:numel(yeardirs) % Find month directories and turn into full paths monthdirs = get_dirs(dir(yeardirs{k})); monthdirs = cellfun(#(x)fullfile(yeardirs{k}, x), monthdirs, 'uni', 0); for m = 1:numel(monthdirs) % Full path to the file that you would like to load filename = fullfile(monthdirs{m}, 'New Text Document.txt'); % Load and process file here fid = fopen(filename, 'rb'); Data = textscan(fid, '%s', 'Delimiter', '\n', 'HeaderLines', 13); fclose(fid); % Remove footer Data = Data{1}; footerRow = regexp(Data, '^pottmp'); isfooter = ~cellfun(#isempty, footerRow); footerInd = find(isfooter, 1, 'first'); Data = Data(1:(footerInd-1)); % Save the result [folder, fname, ext] = fileparts(filename); outname = fullfile(folder, ['modified.', fname, ext]); fid = fopen(outname, 'wt'); fprintf(fid,' \t \t \r\n'); fprintf(fid, '%s\r\n', Data{:}); fclose(fid); end end NOTE: NEVER use files(1:2) = []; to remove the . and .. directories. The result of dir is listed alphabetically and there are directories and files that could be listed before those two so you need to explicitly check to see if the values are actually . and ...