%mandatory -->  dataSource;
%optional  -->  figureName , dimentions , groupsCol;

function dvpMatrixPlot( dataSource , figureName , dimentions , groupsCol) 
dvpStart();
if nargin < 1
    error('not enough parameters');
end

    if ~ischar(dataSource)
        
       if ~isnumeric(dataSource)
          error('invalid dataSoure!'); 
       end
       
     ctr = getappdata(0,'counter');
     dsName = strcat('dataSource ',int2str(ctr+1));
     setappdata(0,'counter',ctr+1);
     dvpCreateDataSource(dataSource,dsName); 
     
    else
        dsName = dataSource;
    end

if ~exist('figureName','var')
    ctr = getappdata(0,'counter');
    figName = strcat('Matrix ',int2str(ctr+1));
    setappdata(0,'counter',ctr+1);
    else
        figName = figureName;
end

if ~exist('dimentions','var') || isempty(dimentions) || ~ischar(dimentions)
    featuresList = 'All-Features';
    
else
    
    if ~isnumeric(dimentions)
        error('Invalid dimentions');
    end
        featuresList = dimentions;
end

if ~exist('groupsCol','var') || isempty(groupsCol)|| isnumeric(groupsCol)
    groups = 'invalid-groups-col';
    
else
        groups = groupsCol;
end

data = struct('requestType', 'create', 'operation', 'figure',...
    'config', struct('figureType', 'ScatterPlotMatrix', 'id',figName,...
    'dataSourceID', dsName,...
    'figureProperties', struct('features',featuresList  , 'groups' , groups)));

dvpSendData(data);

end
