image thumbnail
from The Bullwhip effect simulated in Matlab Environment by stelios ploumpis
A simulated script that allow anyone to understand the bullwhip effect through a basic supply chain.

rules.m
%# read text file lines as cell array of strings
a= pwd;
fid = fopen( fullfile(a,'rules.txt') );
str = textscan(fid, '%s', 'Delimiter','\n'); str = str{1};
fclose(fid);

%# GUI with multi-line editbox
hFig = figure('Menubar','none', 'Toolbar','none');
hPan = uipanel(hFig, 'Title','Structure & Rules','FontSize',16, ...
    'Units','normalized', 'Position',[0.05 0.05 0.9 0.9]);
hEdit = uicontrol(hPan, 'Style','edit', 'FontSize',14, ...
    'Min',0, 'Max',2, 'HorizontalAlignment','left', ...
    'Units','normalized', 'Position',[0 0 1 1], ...
    'String',str);

% %# enable horizontal scrolling
% jEdit = findjobj(hEdit);
% jEditbox = jEdit.getViewport().getComponent(0);
% jEditbox.setWrapping(false);                %# turn off word-wrapping
% jEditbox.setEditable(false);                %# non-editable
% set(jEdit,'HorizontalScrollBarPolicy',30);  %# HORIZONTAL_SCROLLBAR_AS_NEEDED
% 
% %# maintain horizontal scrollbar policy which reverts back on component resize 
% hjEdit = handle(jEdit,'CallbackProperties');
% set(hjEdit, 'ComponentResizedCallback',...
%     'set(gcbo,''HorizontalScrollBarPolicy'',30)')

Contact us