File Exchange

image thumbnail

MatCommon

version 1.0.0 (34.3 KB) by Herianto Lim
Common files for my other MATLAB repositories.

1 Download

Updated 06 Nov 2018

GitHub view license on GitHub

This is a repository which my other MATLAB repositories depend on.

Cite As

Herianto Lim (2020). MatCommon (https://github.com/heriantolim/MatCommon), GitHub. Retrieved .

Comments and Ratings (2)

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).

source: https://www.mathworks.com/help/matlab/ref/isempty.html

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:

https://www.mathworks.com/help/matlab/math/creating-and-concatenating-matrices.html#d120e546

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?

MATLAB Release Compatibility
Created with R2013b
Compatible with R2013b to R2018a
Platform Compatibility
Windows macOS Linux
Tags Add Tags