Hi I would like to plot and process large data array with a GUI. The problem is that with small data array, the user interface works correctly but with large array the plotting (1D and 2D plot) encounters big delays and the interactivity (scrolling, updating…) becomes impossible. What's the best way to plot, process and interact with large data arrays ? Thanks.
MATLAB: Large array
gui
Related Solutions
Here is my approach to your problem. You may have to experiment to get the result you want, because I am identifying the spikes by their respective amplitudes only, since that is how you described them. (The negative amplitudes are easier to identify and isolate, so I used them.) If there are other criteria, you will have to include them, and tweak the code accordingly.
The Code —
D = load('Vanessa Carvalho signal.mat');signal = D.signal;timescale = D.timescale;Fs = D.fs;[negpks1,locidx1] = findpeaks(-signal, 'MinPeakHeight',0.8);[negpks2,locidx2] = findpeaks(-signal, 'MinPeakHeight',0.15);spike2idx = setdiff(locidx2, locidx1);figure(1)plot(timescale, signal)hold onplot(timescale(locidx1), -negpks1, 'vr', 'MarkerFaceColor','r')plot(timescale(spike2idx), signal(spike2idx), 'vg', 'MarkerFaceColor','g')hold offgridaxis([0 0.3 ylim])rep_rate1 = [mean(diff(timescale(locidx1))) std(diff(timescale(locidx1))) median(diff(timescale(locidx1)))]rep_rate2 = [mean(diff(timescale(spike2idx))) std(diff(timescale(spike2idx))) median(diff(timescale(spike2idx)))]
The code is fairly self-explanatory. The idea is to isolate the large-amplitude spikes, then identify the small and large amplitude spikes, then use the setdiff function to isolate the smaller spikes from all the spikes. I used the indices rather than the times because this made the addressing easier for me. See the documentation for the various functions for the details of how they work.
The ‘rep_rate’ vectors are the mean, standard deviation, and median, respectively of the time differences (not indices) in the units you recorded them in.
rep_rate1 = 20.7596e-003 2.7679e-003 20.2000e-003rep_rate2 = 15.1114e-003 9.5616e-003 16.9500e-003
I isolated a section of the plot to illustrate the results in detail. Comment-out the axis call to see the entire series and the isolated spikes.
The (Zoomed) Plot —
The ZOOM function works on 3-D plots, but requires that you use the functional form of ZOOM to zoom in and out. In general, if you zoom in by a factor of X, you can zoom back out using 1/X.
For example:
zoom(.5)
to reverse the results, use:
zoom(2)
Negative numbers (for example, -2) are not valid zoom factors.
Best Answer