Yes, this is to be expected.

MATLAB does allow saving and loading of classdef objects, but Octave has not 
implemented that feature. The MATLAB results struct in MATPOWER 8.0 includes a 
classdef object in the om field and possibly another in the raw.task field. As 
a workaround, assuming you don’t need these objects, you can simply delete them 
before saving …

>> c9opf = runoff(c9);
>> c9opf.om = [];
>> c9opf.raw.task = [];
>> save('-mat','-v7','case9opf.mat','c9opf')

Hope this helps,

   Ray


On Jun 5, 2025, at 7:25 PM, Jovan Ilic <[email protected]> wrote:


It seems that runopf() results cannot be saved in octave.
I tried something like this and octave 8.4 and 10 give me errors.
Am I doing something wrong or is this to be expected? It works
just fine in Matlab. c9opf cannot be saved as ascii file in Matlab nor
octave which makes sense.

I tried this with Matpower 8.0 and 7.1 with the same results.

>> c9 = loadcase('case9.m');
>> c9opf = runopf(c9);
.....
>> save('-mat','-v7','case9opf.mat','c9opf')

warning: struct: converting a classdef object into a struct overrides the 
access restrictions defined for properties. Allproperties are returned, 
including private and protected ones.
warning: struct: converting a classdef object into a struct overrides the 
access restrictions defined for properties. Allproperties are returned, 
including private and protected ones.
warning: struct: converting a classdef object into a struct overrides the 
access restrictions defined for properties. Allproperties are returned, 
including private and protected ones.
warning: save: wrong type argument 'function handle'
error: save: error while writing '' to MAT file


Reply via email to