%% check_grid_result
%   Similar to above function check_grid_result, will loop through
% the cells of the output grid, unline check_grid, does not need to
% recurse.
% inputs:
%   object:GUI - current GUI object
%   grid:RGrid - RGrid object to be checked
% outputs:
%   none
% Author: Colin Eles elesc@mcmaster.ca
% Organization: McMaster Centre for Software Certification
function msg = check_grid_result(object,grid)
msg = [];
for i = 1:size(grid.Cells,2)
    error = '';
    string = get(grid.Cells(i).result,'String');
    
    
    error = object.check_matlab_syntax_condition(char(string),1);
    if isempty(error)
        if (strcmp(string,'') || isempty(string))
            error = 'Cell is empty';
        end
    end
    if ~isempty(error)
        msg = [msg sprintf('\n')];
        
        msg = [msg 'Result -> ' char(string) sprintf('\n')];
        msg = [msg error sprintf('\n')];
        
        
        set(grid.Cells(i).result,'TooltipString',error);
        grid.Cells(i).flag_cell(1);
    else
        set(grid.Cells(i).result,'TooltipString','');
        grid.Cells(i).flag_cell(0);
    end
    
end
end

