Eliminate the values in the rows corresponding to a column which are zero in MATLAB -
i have matrix of data trying analyse. have data , applied processing part , managed information below level in trying apply threshold it. after applied threshold data goes 0 point. wondering if there way eliminate points without leaving 0 in between. figure looks zeros in trying plot without gap x axis time, y axis amplitude. possible plot events in blue , time together?
%find time n = size(prcdata(:,1),1); t=t*(0:n-1)'; figure; plot(t,u); t1=t(1:length(t)/5); x=(length(prcdata(:,4))/5); = u(1 : x); threshold=3.063; a=a>threshold; plot_vals=a.*a; figure; plot(t2,plot_vals1); %gives plot added
i tried code club events without zeros gives me straight line plot @ 0.
%% eliminate rows , colomns 0 b1=plot_vals1(plot_vals1 <= 0, :); figure; plot(b1);
also there way take scatter of figure above? using scatter(t2,plot_vals1); work?
if want display points above threshold, can use logical index , set value of unwanted points nan
:
threshold = 3.063; index = (a <= threshold); a(index) = nan; figure; plot(t1, a);
data points nan
won't displayed, leaving break in plot. here's simple example plots positive points of sine wave in red:
t = linspace(0, 4*pi, 100); y = sin(t); plot(t, y) hold on; index = (y < 0); y(index) = nan; plot(t, y, 'r', 'linewidth', 2);
Comments
Post a Comment