فکر کنم در وتلب شما دستور cols وجود نداره
این را امتحان کنید

function [a,b]= myfun(X,ncols)
cols=@(xx) size(xx,2);
i0=0;i1=0;
while( numel(i1)~=163)
i0=randperm(cols(X));
[ii,i1,jj]=unique(X(:,i0(1:ncols)),'rows');
end
i2=randperm(163);
a=X(i2(1:98),i0);
b=X(i2(99:163),i0);
end