ndi.util.unwrapTableCellContent
UNWRAPTABLECELLCONTENT Recursively unwraps content from a potentially nested table cell.
UNWRAPPEDVALUE = NDI.UTIL.UNWRAPTABLECELLCONTENT(CELLVALUE)
This utility function takes a value, which is often a 1x1 cell array
when read from a MATLAB table, and unwraps it to retrieve the core data.
It handles cases where cells might be nested.
Inputs:
cellValue - The value from a table cell. This can be a direct value
(numeric, char, string) or a cell array (potentially nested).
Outputs:
unwrappedValue - The innermost value. If the original or any nested
cell is empty, or if the content is an empty array `[]`,
it returns NaN. If the final value is a MATLAB string,
it is converted to a char array for consistency.
Example:
myTable = table({{'some_string'}}, {42}, {{[]}}, {{{{true}}}}, 'VariableNames', {'A','B','C','D'});
val_A = ndi.util.unwrapTableCellContent(myTable.A); % Returns 'some_string'
val_B = ndi.util.unwrapTableCellContent(myTable.B); % Returns 42
val_C = ndi.util.unwrapTableCellContent(myTable.C); % Returns NaN
val_D = ndi.util.unwrapTableCellContent(myTable.D); % Returns true