bugGNU Octave - Bugs: bug #54319, saving a classdef to a MAT file...


bug #54319: saving a classdef to a MAT file then loading it crashes Octave

Submitted by:  S├ębastien Villemot <svillemot>
Submitted on:  Mon 16 Jul 2018 04:53:43 PM UTC  
Category:  Interpreter Severity:  4 - Important
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  4.4.0 Operating System:  GNU/Linux

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Fri 20 Jul 2018 03:15:58 AM UTC, comment #3:

I verified the patch works on the original test case posted in comment #0. Marking as fixed and closing report.

Rik <rik5>
Project Administrator
Wed 18 Jul 2018 05:02:15 PM UTC, comment #2:

Thanks for the patch.

I pushed this change to stable and merged with default:


John W. Eaton <jwe>
Project Administrator
Mon 16 Jul 2018 07:20:57 PM UTC, comment #1:

[Just a little OT:]
Being able to properly read/write classdef objects from/to .mat file is a long-standing wish; there's a maintainers-ML thread on it and also a feature request (bug #45833).
IIRC hdf5 I/O is one of the requirements; there's a patch for that that goes some way that I keep alive (I use it in my own octave builds), see patch #8607.

Philip Nienhuis <philipnienhuis>
Project Member
Mon 16 Jul 2018 04:53:43 PM UTC, original submission:


Assume you have defined the following trivial classdef:

Then the following sequence crashes Octave:

The problem is that Octave tries to reload the object as if it was a legacy class, instead of a classdef.

I attach a draft patch that prevents the crash and make Octave return a struct.

Ideally Octave should rather return a classdef value (see also bug #45833). I would be willing to write such a patch, but I would ideally need some guidance (concerning the complexity of the task and the pitfalls to avoid).


S├ębastien Villemot <svillemot>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #44564:  classdef-mat-load.patch added by svillemot (726B - text/x-patch)


Depends on the following items: None found

   bug dependencies.


Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by svillemot (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-08-06 mtmiller Dependencies- => bugs #54455 is dependent
    2018-07-20 rik5 Severity3 - Normal => 4 - Important
        StatusReady For Test => Fixed
        Open/ClosedOpen => Closed
    2018-07-18 jwe StatusNone => Ready For Test
    2018-07-16 svillemot Attached File- => Added classdef-mat-load.patch, #44564

    Back to the top

    Powered by Savane 3.4