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: mergeImageData.m
    path of file: ./repos/GIBBON/lib
    
    the code of the file until where you have to start completion: function [N12,G12]=mergeImageData(N1,G1,N2,G2,nFac,plotOn)

% function [N12,G12]=mergeImageData(N1,G1,N2,G2,nFac,plotOn)
% ------------------------------------------------------------------------
%
% nFac=Factor for sub-division, smallest voxel dimension in v1 is aimed to be equivalent to nFac*v2_sub
%
%
%
% Kevin Mattheus Moerman
% kevinmoerman@hotmail.com
% 2014/01/28
%

    
function [N12,G12]=mergeImageData(N1,G1,N2,G2,nFac,plotOn)

% function [N12,G12]=mergeImageData(N1,G1,N2,G2,nFac,plotOn)
% ------------------------------------------------------------------------
%
% nFac=Factor for sub-division, smallest voxel dimension in v1 is aimed to be equivalent to nFac*v2_sub
%
%
%
% Kevin Mattheus Moerman
% kevinmoerman@hotmail.com
% 2014/01/28
%
% 2014/01/28, fixed sparse input such that input sizes are consistent i.e.
% added (:) to form column
%------------------------------------------------------------------------

%%

%Creating subImage indices using first image
nSub=round(G2.v./min(G1.v(:)/nFac))'; %Sub-division specification, can be inhomogeneous since it depend