The apply_changes() function can be used to disable branches and buses by setting the BR_STATUS to column to 0 for a branch or the BUS_TYPE column to NONE for a bus, but it cannot be used to actually delete rows from the branch and bus matrices.
For example, to disconnect branch 3 and bus 4, you could use the following ... define_constants; chgtab = [ ... 1 0.1 CT_TBRCH 3 BR_STATUS CT_REP 0; 2 0.1 CT_TBUS 4 BUS_TYPE CT_REP NONE; ]; Hope this helps, Ray > On Jun 21, 2017, at 3:09 PM, Andrey Vieira <andre...@hotmail.com> wrote: > > Hello All, > I would know for optimization by matlab the following procedure: > > I know that savecase() function is used to create a MATPOWER case file from a > case struct. For example, I suppose want to take an existing case file, > say case30.m, and apply a set of changes to it using apply_changes() and > save the result as a new MATPOWER case file called case30new.m. The solution > could to be with the following code … > > mpc0 = loadcase('case30'); > mpc = apply_changes(label, mpc0, chgtab); > savecase('case30new', mpc); > > Now I can use case30new as you would any of the included cases. E.g. > r = runopf('case30new'); > > What would the chgtab array look like if I wanted to just > delete buses and branches from the case30?