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: f_readB16.m
    path of file: ./repos/PIVlab
    
    the code of the file until where you have to start completion: % readB16.m
function image = readB16(dirPath, filename)
% readB16.m  Read PCO *.b16 image file
%
% image = readB16(filename)
%       = readB16(dirPath, filename)
%
% where: image - 2D array of image
%     filename - path and filename (string)
%      dirPath - optional directory path (string)
% 
% Example usage: 
%  For a file 'image.b16' located in the local directory 'files', the following
%  will be successful
%    image = readB16('files/image.b16')
%    image = readB16('files/','image.b16')
%
%  and the following will cause failure with fd=-1
%    image = readB16('files/image.B16')
%    image = readB16('files','image.b16')
%    image = readB16('files','image.B16')
% 
% Image is returned as a 2D array, where only 1 image is stored in each *.b16 file.
%
% Only b/w images have been tested, and importing color images should 
% throw an error.
%

% Author: Carl Hall
% Date: Spring 2016

% Modificat
    
function image = readB16(dirPath, filename)
% readB16.m  Read PCO *.b16 image file
%
% image = readB16(filename)
%       = readB16(dirPath, filename)
%
% where: image - 2D array of image
%     filename - path and filename (string)
%      dirPath - optional directory path (string)
% 
% Example usage: 
%  For a file 'image.b16' located in the local directory 'files', the following
%  will be successful
%    image = readB16('files/image.b16')
%    image = readB16('files/','image.b16')
%
%  and the following will cause failure with fd=-1
%    image = readB16('files/image.B16')
%    image = readB16('files','image.b16')
%    image = readB16('files','image.B16')
% 
% Image is returned as a 2D array, where only 1 image is stored in each *.b16 file.
%
% Only b/w images have been tested, and importing color images should 
% throw an error.
%

% Author: Carl Hall
% Date: Spring 2016

% Modification History
%  March 2016 - Original Code

%% b16 Header byte Structure
% 
% Bytes    Type      Description
% 4        chars     "PCO-" 
% 4        int32     File size in byte       
% 4        int32     file size in byte 
% 4        int32     header size + comment filed in byte
% 4        int32     image width in pixel 
% 4        int32     image height in pixel 
% 4        int32     -1 (true), extend