I want to construct an struct object with three properties:
arg1 = 42;
arg2 = 'test';
arg3 = cell(0);
But if I try to initialize that object:
struct('arg1', arg1, 'arg2', arg2, 'arg3', arg3);
It returns an empty struct:
ans =
0×0 empty struct array with fields:
arg1
arg2
arg3
I figured out the empty cell is the culprit, so if i initialize it without the empty cell it returns a correct value:
ans =
struct with fields:
arg1: 42
arg2: 'test'
arg3: []
But I need my code to work with empty cells, and I don't know if or where they will be in one of the fields.
Is there a way to get out of this problem?