splitting a periodic sweeping matrix
Ältere Kommentare anzeigen
I have a matrix that goes from a negative value to a positive value through 0 and then from a positive value to negative value . This is repeated for 100 times. How do i divide the matrix so that i get all the negative sweeps in one matrix and all the positive sweep in another. For example see the attached file.
Antworten (1)
Matt J
am 25 Nov. 2014
neg=A(A<=0);
pos=A(A>0);
2 Kommentare
DebiPrasad
am 25 Nov. 2014
idx=diff(A)>0;
idx=[idx(1), idx];
pos_sweeps=A(idx);
neg_sweeps=A(~idx);
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!