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: spm_data_hdr_write.m
    path of file: ./repos/spm12
    
    the code of the file until where you have to start completion: function V = spm_data_hdr_write(V)
% Write data information to disk
% FORMAT V = spm_data_hdr_write(V)
% V        - a structure array (see spm_data_hdr_read)
%__________________________________________________________________________
% Copyright (C) 2012-2016 Wellcome Trust Centre for Neuroimaging

% Guillaume Flandin

    
function V = spm_data_hdr_write(V)
% Write data information to disk
% FORMAT V = spm_data_hdr_write(V)
% V        - a structure array (see spm_data_hdr_read)
%__________________________________________________________________________
% Copyright (C) 2012-2016 Wellcome Trust Centre for Neuroimaging

% Guillaume Flandin
% $Id: spm_data_hdr_write.m 6752 2016-03-24 16:17:25Z guillaume $


switch lower(spm_file(V(1).fname,'ext'))
    case {'nii','hdr','img'}
        if ~isfield(V(1),'dat'), V = spm_create_vol(V); end