Code covered by the BSD License  

Highlights from
Supply Chain Risk Simulator (SCRS)

from Supply Chain Risk Simulator (SCRS) by Marco Anisetti
Supply Chain simulator for risk assessment and incentive schemes.

Incentives(varargin)
function varargout = Incentives(varargin)
% INCENTIVES M-file for Incentives.fig
%      INCENTIVES, by itself, creates a new INCENTIVES or raises the existing
%      singleton*.
%
%      H = INCENTIVES returns the handle to a new INCENTIVES or the handle to
%      the existing singleton*.
%
%      INCENTIVES('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in INCENTIVES.M with the given input arguments.
%
%      INCENTIVES('Property','Value',...) creates a new INCENTIVES or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before Incentives_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to Incentives_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help Incentives

% Last Modified by GUIDE v2.5 28-Mar-2010 10:43:20

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @Incentives_OpeningFcn, ...
                   'gui_OutputFcn',  @Incentives_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before Incentives is made visible.
function Incentives_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to Incentives (see VARARGIN)

% Choose default command line output for Incentives
handles.output = hObject;

handles.Suppliers=varargin{1}
risks=varargin{2};
risksI=varargin{3};
impacts=varargin{4};
impactsI=varargin{5};


nomi=cell(length(handles.Suppliers)-1,1);
for i=1:1:(length(handles.Suppliers))
    nomi{i}=handles.Suppliers(i).Name;
end
axes(handles.incent) % Select the proper axes
set(handles.incent,'XTick',[1:(length(handles.Suppliers))]);
set(handles.incent,'XTickLabel',nomi);

a=[risks;risksI]';
hold on
bar(a,'group')
hold off



% Update handles structure
guidata(hObject, handles);

% UIWAIT makes Incentives wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = Incentives_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;

Contact us at files@mathworks.com