From: us on 3 Apr 2010 03:38 "Kenneth Galea" > x=pi; % <- bad data marker... > v=[x x 2 3 4 x 1 1 2 8 x x x x 4 5 8 9]; > % i need to have outputs (2&4) (1&8) (4&9) i.e. the first and last element of each set. one of the solutions x=pi; % <- bad data marker... v=[x x 2 3 4 x 1 1 2 8 x x x x 4 5 8 9]; ix=[false,v~=pi,false]; ib=strfind(ix,[0,1]); ie=strfind(ix,[1,0])-1; r=[v(ib);v(ie)] %{ % r = 2 1 4 4 8 9 %} us
First
|
Prev
|
Pages: 1 2 Prev: import input matrix to FIS Next: rounding up symbolic expression to 3 decimal places |