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: loadNwbCellMetrics.m
    path of file: ./repos/CellExplorer/calc_CellMetrics
    
    the code of the file until where you have to start completion: function cell_metrics = loadNwbCellMetrics(nwb_file)
% Generate cell_metrics from a nwb file (NeurodataWithoutBorder). Output is compatible with CellExplorer
% The nwb file should be generated from the cell_metrics using saveCellMetrics2nwb.m
%

    
function cell_metrics = loadNwbCellMetrics(nwb_file)
% Generate cell_metrics from a nwb file (NeurodataWithoutBorder). Output is compatible with CellExplorer
% The nwb file should be generated from the cell_metrics using saveCellMetrics2nwb.m
%
% The format is described here:https://cellexplorer.org/datastructure/standard-cell-metrics/
%
% Example call:
% cell_metrics = loadNwbCellMetrics('file.nwb');
%
% Now you may run CellExplorer: 
% cell_metrics = CellExplorer('metrics',cell_metrics);

% By Peter Petersen
% petersen.peter@gmail.com
% Last updated: 05-07-2021

% TODO 
% nwb3.general_experimenter?

nwb = nwbRead(nwb_file);

cell_metrics = {};

% General fields
cell_metrics.general.session.investigator = nwb.general_experimenter;
cell_metrics.general.basepath = nwb.session_description;
cell_metrics.general.basename = nwb.identifier;


cell_metrics.general.animal.sex = nwb.general_subject.sex;
cell_metrics.general.animal.species = nwb.general_subject.species;
cell_metrics.general.animal.strain = nwb.general_subject.strain;
cell_metrics.general.animal.geneticLine = nwb.general_subject.genotype;
cell_metrics.general.animal.name = nwb.general_subject.subject_id; % must be a metric

cell_metrics.general.cellCount = nwb.units.id.data.dims;

% Adding basepath to file
try
    [basepath,~,~] = fileparts(nwb_file);
    cell_metrics.general.basepath = basepath;
end