Code covered by the BSD License  

Highlights from
Developing a Financial Market Index Tracker using MATLAB OOP and Genetic Algorithms

Developing a Financial Market Index Tracker using MATLAB OOP and Genetic Algorithms

by

 

01 Aug 2008 (Updated )

Files used in the webinar of the same name

Object_DemoScript.m
%% Object Demostration script
% Simple script to run through some properties of MATLAB objects that we
% use in the Index tracker demostration.
clear classes; clc
%% Pass by reference
% DemoObject inherits from the handle class, so we can now do pass by
% reference
edit  DemoObject;

%%
obj = DemoObject

obj.Value = 2

%% Events
% Add a listener to the object and then send the event
L = addlistener(obj,'Catastrophe',@(src,evt) disp('Disaster Detected'));

%%
notify(obj,'Catastrophe');

%% 
% Objects can listen to events in other objects. Also events can carry data
% with them.
edit DemoObject2

%%
obj2 = DemoObject2;
ListenFor(obj2,obj,'Catastrophe');

%%
SendEvent(obj);

Contact us