function modelID = createArrayViewerModel(variableName, varargin)
model = compiler.internal.MLArrayViewerModel;

if(nargin == 2)
data = varargin{1};
else
data = createStruct(varargin{:});
end

model.assignin(variableName, data);
modelID = model.getWorkspaceID;

end

function data = createStruct(varargin)
for i = 1:2: length(varargin)
sCommand = ['data.' varargin{i} ' = varargin{' num2str(i+1) '};'];
eval(sCommand);
end

end