Skip to content

cellarray of struct donesn't correctly check fields to precede in makematrices of ReadYaml #1

@babaq

Description

@babaq

I have a yaml file like this:

condtestpath: ConditionTest_V1_358_conditiontest_1.yaml
condtest:
CONDSTATE:

  • - PREICI: 20.2806
    • COND: 128.3246
    • SUFICI: 632.8663
  • - PREICI: 733.4108
    • COND: 833.4752
    • SUFICI: 1333.7605
  • - PREICI: 1451.4685
    • COND: 1566.3031
    • SUFICI: 2083.5186
  • - PREICI: 2198.9955
    • COND: 2300.4615
    • SUFICI: 2801.3268
  • - PREICI: 2916.3761
    • COND: 3032.1373
    • SUFICI: 3532.1772
  • - PREICI: 3644.487
    • COND: 3746.5744
    • SUFICI: 4249.5801
  • - PREICI: 4366.9403
    • COND: 4480.8218
    • SUFICI: 4982.1106
  • - PREICI: 5099.0864
    • COND: 5214.5976
    • SUFICI: 5716.7272

after readyamlraw, in makematrices in
function result = iscompatible(obj1, obj2)
import yaml.*;
result = isequal(class(obj1), class(obj2));
end

it's always return true because it doesn't check if obj1 and obj2 have the same number of fields and if those fields have the same names, so it will precede to try to make a matrices out of the cell array of struct which may not have the same number of fields/names

the quickest way to avoid such thing is to add fields checking, I could make a small PR if you like.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions