Recursive version of isempty() for cells and structures

版本 1.0.0.0 (2.0 KB) 作者: Kevin Bartlett
Returns true for cell arrays/structures that are not empty, but have only empty cells/fields.
225.0 次下载
更新时间 2011/9/26

查看许可证

Matlab's isempty() returns false for a structured variable that contains one or more fields. In some circumstances, however, a structured variable may have been initialised with empty fields to be populated later; in this case, we might want to consider the structure to be empty if the fields themselves are empty.

isemptyr() tests for this condition by recursively checking the fields of a structured variable, returning true if only empty fields are found.

Similarly, for cell arrays, Matlab's isempty() returns false if the array contains one or more cells, even if they are empty. isemptyr(), in contrast, searches the cell array recursively, returning true if only empty cells are found.

isemptyr() works just like Matlab's isempty() for normal arrays and strings.

引用格式

Kevin Bartlett (2024). Recursive version of isempty() for cells and structures (https://www.mathworks.com/matlabcentral/fileexchange/33030-recursive-version-of-isempty-for-cells-and-structures), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2011a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Structures 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0