remove.m

来自「这是一个很适合研究和学习用的电力系统仿真软件」· M 代码 · 共 31 行

M
31 行
字号
function a = remove(a,idx)

if ~a.n, return, end
if isempty(idx), return, end

for i = 1:length(idx)
  jdx = find(a.ty1 == idx(i));
  if jdx 
    a.ty1(jdx) = [];
  end
  jdx = find(a.ty2 == idx(i));
  if jdx 
    a.ty2(jdx) = [];
    a.x2(jdx) = [];
  end  
  jdx = find(a.pod == idx(i));
  if jdx, a.pod(jdx) = []; end
end

a.con(idx,:) = [];
a.bus1(idx) = [];
a.bus2(idx) = [];
a.line(idx) = [];
a.n = a.n - length(idx);
a.x1(idx,:) = [];
a.B(idx,:) = [];
a.Cp(idx,:) = [];
a.x0(idx,:) = [];
a.Pref(idx,:) = [];
a.y(idx,:) = [];

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?