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: WriteSuStructure.m
    path of file: ./repos/segymat
    
    the code of the file until where you have to start completion: % WriteSuStructure : writes data to disk using SU-CWP format
%
% EX
% WriteSuStruct
    
function WriteSuStructure(filename,SegyTraceHeaders,Data,SegyHeader)

if nargin<3;
    SegymatVerbose(sprintf('%s: Neads at least filename,SuTraceHeaders and Data',mfilename,filename),0)
    return
end    
if nargin<4
    SegyHeader.Rev=GetSegyHeaderBasics;
    SegyHeader.FixedLengthTraceFlag=1;
end
% FORCE THE USE OF IEEE
SegyHeader.SegyFormatRevisionNumber=100;
SegyHeader.DataSampleFormat=5; % IEEE 



SegymatVerbose(sprintf('%s: writing to %s',mfilename,filename),0)


segyid = fopen(filename,'w');   % USE LOCAL ENDIAN FLAG,
% I.E. ENDIAN FORMAT NOT SPECIFIED
% segyid = fopen(filename,'w','b'); % BIG ENDIAN

ntraces=size(Data,2);
for i=1:ntraces;
    if (i/1000)==round(i/1000),
      SegymatVerbose(['writing trace ',num2str(i),' of ',num2str(ntraces),', filepos=',num2str(ftell(segyid))],0)
      SegymatVerbose(SegyTraceHeaders(i).ns,1)
    end