For what you're looking for, ismember is better than setdiff --
x=[2;1;5;6;8];
y=[1;2;5;6]; % wanted values of x1
>> Tx=x1(ismember(x,y),:)
Tx =
1 0 0
0 1 1
1 0 2
2 0 1
>>
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!