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: writeHDF5Data.m
    path of file: ./repos/ciatah/+ciapkg/+hdf5
    
    the code of the file until where you have to start completion: function [success] = writeHDF5Data(inputData,fileSavePath,varargin)
	% [success] = writeHDF5Data(inputData,fileSavePath,varargin)
	% 
	% Saves input data to a HDF5 file, tries to preserve datatype.
	% 
	% Biafra Ahanonu
	% started: 2013.11.01
	%
	% inputs
	% 	inputData: matrix, [x y frames] preferred.
	% 	fileSavePath: str, path where HDF5 file should be saved.
	% outputs
	% 	success = 1 if successful save, 0 if error.
	% options
	% 	datasetname = HDF5 hierarchy where data should be stored

	% changelog
		% 2014.01.23 - updated so that it saves as the input data-type rather than defaulting to double
		% 2014.10.06 - added chunking to save, decrease compatibility problems.
		% 2015.06.19 - added automatic creation of file's directory if it doesn't already exist.
		% 2019.03.19 [17:37:38] User option to customize chunking instead of using whole x-y, useful for very large FOV movies
		% 2020.07.07 [00:08:45] - Update addInfo to use h5write.
		% 2021.08.08 [19:30:20] - Updated to handle CIAtah v4.0 switch to all functions inside ciapkg package.

    
function [success] = writeHDF5Data(inputData,fileSavePath,varargin)
	% [success] = writeHDF5Data(inputData,fileSavePath,varargin)
	% 
	% Saves input data to a HDF5 file, tries to preserve datatype.
	% 
	% Biafra Ahanonu
	% started: 2013.11.01
	%
	% inputs
	% 	inputData: matrix, [x y frames] preferred.
	% 	fileSavePath: str, path where HDF5 file should be saved.
	% outputs
	% 	success = 1 if successful save, 0 if error.
	% options
	% 	datasetname = HDF5 hierarchy where data should be stored

	% changelog
		% 2014.01.23 - updated so that it saves as the input data-type rather than defaulting to double
		% 2014.10.06 - added chunking to save, decrease compatibility problems.
		% 2015.06.19 - added automatic creation of file's directory if it doesn't already exist.
		% 2019.03.19 [17:37:38] User option to customize chunking instead of using whole x-y, useful for very large FOV movies
		% 2020.07.07 [00:08:45] - Update addInfo to use h5write.
		% 2021.08.08 [19:30:20] - Updated to handle CIAtah v4.0 switch to all functions inside ciapkg package.
	% TODO
		% Add option to overwrite existing HDF5 file ()

	import ciapkg.api.* % import CIAtah functions in ciapkg package API.

	%========================
	% old way of saving, only temporary until full switch
	% Str: name of HDF5 dataset to save data into.
	options.datasetname = '/1';
	% HDF5: append