MATLAB: Is it possible to get a Table from an mxArray in a MEX function

MATLABmexmxarraytable

I have a bunch of data in Tables (i.e. using the table data type introduced a few releases ago) and I would like to pass this to a MEX function.
I cannot find anything in the mxArray documentation regarding how to get a table from a mxArray. Does such functionality exist?
If it doesn't exist, what are the alternatives and/or is it planned for the near future?

Best Answer

The best solution I could find is to create a MATLAB function to convert a table to struct of arrays as shown below (and then pass that struct to the MEX function). The function for doing so is attached.
I would very much appreciate hearing about other proposed solutions from those in the community who are more expert than myself.
function [ outStruct ] = table2structofarrays( inTable )
%TABLE2STRUCTOFARRAYS Convert a table to a struct of arrays.
% Usage: outStruct = TABLE2STRUCTOFARRAYS( inTable )
%

% Convert a table with M rows and N variables to a struct with N fields,
% each of which contains a 1-dimensional array of length M and where the
% field names in the struct are the same as the variable names in the
% table.
%
% NOTE: There ia a built-in function TABLE2STRUCT which converts a table to
% an array of structs. However, there are HUGE performance advantages of
% a struct of arrays over an array of structs.
% Make sure the input really is a table
if ~isa(inTable, 'table')
error('Error. Input to function %s must be a table, not a %s', mfilename, class(inTable))
end
% Create an empty struct with no fields
outStruct = struct;
% If the table has explicitly defined row names, then add a field for these
if ~isempty(inTable.Properties.RowNames)
outStruct = setfield(outStruct, 'RowNames', inTable.Properties.RowNames)
end
% Iterate through all of the variables in the table
for varNum=1:width(inTable)
% Get the variable name as a cell array with 1 element
varNameCell = inTable.Properties.VariableNames(varNum);
% Extract the variable name as a string
varName = varNameCell{1};
% Add a new field to the struct containing the data for this variable
outStruct = setfield(outStruct, varName, inTable.(varNum));
end
end