idx = EV > 0;if iscolumn(idx), idx = idx'; end;idx2 = [0, idx, 0];prePt = []; postPt = [];for i = 2 : length(idx2)-1 if idx2(i-1) == 0 & idx2(i) == 1 & idx2(i+1) == 1 prePt = [prePt, i-1]; end if idx2(i-1) == 1 & idx2(i) == 1 & idx2(i+1) == 0 postPt = [postPt,i-1]; end endsegNum = length(prePt);segment = [];for k = 1 : segNum segment(k,:) = [prePt(k), postPt(k)];end
MATLAB: Hii I am not understanding this code please help and explain me step by step and please explain me idx2 = [0, idx, 0] what does it do.
mathematicsMATLAB
Best Answer