📄 elimcol.m
字号:
% elimcol.m
% Scope: This MATLAB macro eliminates a specific column of a given two
% dimensional matrix.
% Usage: y = elimcol(x,k)
% Description of parameters:
% x - input, initial two dimensional matrix
% k - input, index of the column to be eliminated from
% the matrix x
% y - output, resultant matrix
% Last update: 06/26/00
% Copyright (C) 1996-00 by LL Consulting. All Rights Reserved.
function y = elimcol(x,k)
[xrow,xcol] = size(x);
if (xcol < 2) | (k < 1) | (k > xcol)
disp('Error - ELIMCOL ; check dimension or range of index k');
disp(' ');
return
end
if k == 1 % eliminate first column
y = x(:,2:xcol);
elseif k == xcol % eliminate last column
xcolm1 = xcol - 1;
y = x(:,1:xcolm1);
else
km1 = k - 1;
kp1 = k + 1;
y = [x(:,1:km1) x(:,kp1:xcol)];
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -