Hey
How to turn v into zeros and just keep the maximum and the minimum alement?
% Generate v
n=[1,5];v=unifrnd(-1, 5, n);% Remove Direct Dublications
v = v([true, diff(v)~=0]);
indexindexingvectorvectorizationvectors
% Generate v
n=[1,5];v=unifrnd(-1, 5, n);% Remove Direct Dublications
v = v([true, diff(v)~=0]);
Best Answer