My question is:
What is the difference between S
and S(:)
if S
is an empty struct.
I believe that there is a difference because of this question: Adding a field to an empty struct
Minimal illustrative example:
S = struct(); %Create a struct
S(1) = []; %Make it empty
[S(:).a] = deal(0); %Works
[S.b] = deal(0); %Gives an error
The error given:
A dot name structure assignment is illegal when the structure is empty. Use a subscript on the structure.