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: plotsim.m
    path of file: ./repos/CanlabCore/CanlabCore/OptimizeDesign11/other_functions
    
    the code of the file until where you have to start completion: function SIM = plotSim(SIM,varargin)	
% function SIM = plotSim(SIM,'add' [opt],'color',[.4 .3])	
% plotting the SIM model
% ============================================================================================
% use OptimizeDesign scripts to create a SIM struct, then plot it using this.

    
function SIM = plotSim(SIM,varargin)	
% function SIM = plotSim(SIM,'add' [opt],'color',[.4 .3])	
% plotting the SIM model
% ============================================================================================
% use OptimizeDesign scripts to create a SIM struct, then plot it using this.
% 'add' adds to current plot instead of making new figure
% 'color', followed by 4 numbers btwn 0 and 1, modifies color scheme.
%		colors are: 1-2 = [r g] for random.  3-4 = [g b] for ga.
% 'nonoise' : suppress noise text.
% last modified 5/21/01 Tor Wager
	
	addtoplot = 0; 
	noisetext = 1;
	color = [.2 .3 .5 .5];
	for i = 1:nargin-1
		if isstr(varargin{i})
			switch varargin{i}
			case 'add', addtoplot = 1;
			case 'color',color = varargin{i+1};	
			case 'nonoise',noisetext = 0;	
			end