clc
e=input('Enter the matrix:');
[x y]=size(e);
Y=[];
d=input('Enter the column you want to remove:');
for i=1:x for j=1:y if(j~=d) Y=[Y e(i,j)]; end end
end
w=[];
t=1;
for i=1:x for j=1:y-1 w(i,j)=Y(t); t=t+1; end
end
disp(w);
Function:
function w=column_removal(e,d)
[x y]=size(e);
Y=[];
t=0;
k=1;
l=1;
for i=1:x for j=1:y if(j~=d) Y=[Y e(i,j)]; end end
end
w=[];
t=1;
for i=1:x for j=1:y-1 w(i,j)=Y(t); t=t+1; end
end
end
Không có nhận xét nào:
Đăng nhận xét