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: restoreGlobalState.m
    path of file: ./repos/matlab2tikz/test/private
    
    the code of the file until where you have to start completion: function restoreGlobalState(orig)
% Restore original properties of global state.
% See #542 and #552

    
function restoreGlobalState(orig)
% Restore original properties of global state.
% See #542 and #552
    fprintf('Restore global state...\n');
    
    % Restore relevant properties
    state_fields = fieldnames(orig);
    for i = 1:length(state_fields)
        set(0, state_fields{i}, orig.(state_fields{i}).val);
    end