File size: 2,847 Bytes
5ab75a9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | function isEmptyCell = isempty_cell(cell_array)
% isempty_cell - Check which cells in a cell array are empty.
%
% Syntax: isEmptyCell = isempty_cell(cell_array);
%
% =========================================================================
%
% Copyright (c) 2026 United States Government as represented by the
% Administrator of the National Aeronautics and Space Administration.
% All Rights Reserved.
%
% This software developed under RIGHTS IN DATA - special works
% (FAR 52.227-17) as modified by NFS 1852.227-17.
%
% =========================================================================
%
% Description:
%
% Returns logical array indicating which cells in the input cell array
% are empty. If input is not a cell array, the output array is empty.
%
% The Matlab function isempty checks whether or not the entire cell
% array is empty. isempty_cell checks each cell in the cell array and
% returns which cells are empty and which are not.
%
% Example:
% c = {11, '12', [], [];
% [1,2,3], [], 23, [];
% [], 32, 33, [1,2,3;4,5,6]};
% isEmptyCell = isempty_cell(c)
% isEmptyCell =
% 0 0 1 1
% 0 1 0 1
% 1 0 0 0
%
% =========================================================================
%
% Input:
%
% cell_array - Input cell array
%
% =========================================================================
%
% Output:
%
% isEmptyCell - Array same size as cell_array with true
% where cell is empty and false where cell is not
% empty. If the input array is not a cell array,
% isEmptyCell is an empty array.
%
% =========================================================================
%
% Initial version: Mar 2016; Latest update: Apr 2026
%
% ----------------- BEGIN CODE -----------------
if ~iscell(cell_array)
isEmptyCell = [];
return
end
isEmptyCell = cellfun(@isempty,cell_array);
% ----------------- END OF CODE ------------------
%
% Please record any changes to the software in the change history
% shown below:
%
% ----------------- CHANGE HISTORY ------------------
% Developer | Date | Description
% ---------------------------------------------------
% R. Coon | 2016-Mar-03 | Initial version.
% J. Halpin | 2026-Apr-22 | Reformatted header to match code standards.
% | | Added footer
% =========================================================================
%
% Copyright (c) 2026 United States Government as represented by the
% Administrator of the National Aeronautics and Space Administration.
% All Rights Reserved.
%
% ========================================================================= |