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: legend.m
    path of file: ./repos/CanlabCore/CanlabCore/@fmridisplay
    
    the code of the file until where you have to start completion: function obj = legend(obj, varargin)
% Creates legend for fmridisplay object
% Adds legend axis handles to obj.activation_maps{:}
%
% :Usage:
% ::
%
%     obj = legend(obj, varargin)
%
%     obj = legend(obj, 'figure') % new figure
%
% ..
%    Tor Wager
%    8/17/2016 - pkragel updated to accomodate split colormap
% ..
%
% Notes: scaleanchors
    
function






function [legvals, rgb] = get_split_colormap_values_and_colors(nsteps, scaleanchors, currentmap)
% Values corresponding to colors
legvals = zeros(nsteps + 3, 1);
legvals = linspace(scaleanchors(1), scaleanchors(2), nsteps./2)';
legvals = [legvals; 0; 0; scaleanchors(3); linspace(scaleanchors(3), scaleanchors(4), nsteps./2)'];

% Colors
rgb = zeros(nsteps + 3, 3);

for i = 1:3
    rgb1(:, i) = linspace(currentmap.mincolor(2, i), currentmap.maxcolor(2, i), nsteps./2)';
end