Syntax
e=isemptycell(A)
Input Parameter
Output Parameter
Examples
A=SGsample(20), isemptycell(A)
Copyright 2020-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
This function, isemptycell
, is designed to determine if elements within a cell array are empty. It extends the functionality of the standard isempty
function to work with cell arrays.
Input Parameters
- A: A cell array that can contain various types of data, including other cell arrays.
Output Results
- e: A logical array indicating whether each element in the cell array
A
is empty.
Algorithm Steps
- Check if the input
A
is a cell array using iscell(A)
.
- If
A
is not a cell array, use the standard isempty
function to determine if A
is empty and return the result.
- If
A
is a cell array, initialize a logical array e
with the same size as A
, filled with false
.
- Iterate over each element of the cell array
A
using a for
loop.
- For each element
A{i}
, recursively call isemptycell
to determine if it is empty.
- Check if the result
ei
from the recursive call is a scalar. If not, throw an error indicating a mix of subsets with different sizes.
- Assign the result
ei
to the corresponding position in the logical array e
.
- After the loop, return the logical array
e
.
Example
To use the function, you can create a sample cell array using SGsample(20)
and then call isemptycell(A)
to check which elements are empty.
Algorithm explaination created using ChatGPT on 2025-08-18 22:26. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21