This is a repository which my other MATLAB repositories depend on.
Herianto Lim (2020). MatCommon (https://github.com/heriantolim/MatCommon), GitHub. Retrieved .
Hi Stephen. Thanks for the feedback. I removed isemptystruct.m because it is not used in any of my other codes, and as you pointed out, it creates confusion. Thanks for the lecture. I did understand the definition.
This statement is incorrect: "Empty struct refers to a struct that has no fields."
An empty struct is just like any other array in MATLAB, it has one dimension with size zero. All empty arrays, regardless of class, return TRUE from the function ISEMPTY: "An empty array has at least one dimension of size zero, for example, 0-by-0 or 0-by-5" (and this applies to structure arrays just like it does to any other array class).
Lets try some simple examples, to see if anyone notices the pattern:
size 1x0 numeric -> empty
size 1x0 logical -> empty
size 1x0 char -> empty
size 1x0 cell -> empty
size 1x0 struct -> empty
The number of fields a structure has is totally independent of how many fields it has: an empty structure could have a thousand fields. A confused and misleading usage of the meaning "empty" is not a good indication that the author follows and understands MATLAB conventions and terminology:
Question for the author: how would they describe an empty structure, e.g. one with size 0x0, in a way that does not conflict with their (incorrect) terminology?