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: spm_save.m
    path of file: ./repos/spm12
    
    the code of the file until where you have to start completion: function spm_save(f,var,varargin)
% Save text and numeric data to file
% FORMAT spm_save(f,var,opts,...)

    
function spm_save(f,var,varargin)
% Save text and numeric data to file
% FORMAT spm_save(f,var,opts,...)
% f     - filename (can be gzipped) {csv,tsv,json,txt,mat,npy}
% var   - data array or structure
% opts  - optional inputs to be passed on to lower level function
%__________________________________________________________________________
% Copyright (C) 2018-2019 Wellcome Trust Centre for Neuroimaging

% Guillaume Flandin
% $Id: spm_save.m 7668 2019-09-27 10:44:45Z guillaume $


ext = lower(spm_file(f,'ext'));
if isempty(ext), ext = ''; end