You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: generatePlots.m
    path of file: ./repos/vitruvio/scripts/plotting
    
    the code of the file until where you have to start completion: function [] = generatePlots(viewPlots, data, task, optimizeLeg, saveFiguresToPDF)
%% Create title page for the pdf

    
function [] = generatePlots(viewPlots, data, task, optimizeLeg, saveFiguresToPDF)
%% Create title page for the pdf

classSelection = data.basicProperties.classSelection;
if saveFiguresToPDF
    figure('name', 'Title Slide', 'DefaultAxesFontSize', 10, 'units','normalized','outerposition',[0 0 1 1])
    set(gcf,'color','w')
    text(0.5,0.5,['Results of vitruvio simulation for ', classSelection, ' ', task], 'FontSize', 22,'HorizontalAlignment', 'center');
    set(gca, 'visible', 'off', 'xtick', []);
    export_fig results.pdf -nocrop -append