From c56bfab0edf9fe105be49a10d8ddf21c8af95f5e Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Sat, 24 Mar 2012 01:33:54 +0000 Subject: [PATCH] Matlab: Allow simpler syntax for creating ReactorNets with one reactor A network with a single reactor can be created with either: ReactorNet({reactor}), i.e. a single element cell array or, the new way: ReactorNet(reactor) --- interfaces/matlab/toolbox/@ReactorNet/ReactorNet.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/interfaces/matlab/toolbox/@ReactorNet/ReactorNet.m b/interfaces/matlab/toolbox/@ReactorNet/ReactorNet.m index 90cbccf14..15c7f8d33 100644 --- a/interfaces/matlab/toolbox/@ReactorNet/ReactorNet.m +++ b/interfaces/matlab/toolbox/@ReactorNet/ReactorNet.m @@ -9,6 +9,11 @@ else error('wrong number of arguments to ReactorNet constructor'); end +if isa(reactors, 'Reactor') + % Allow simpler syntax for creating a network with one reactor + reactors = {reactors}; +end + x.index = reactornetmethods(0,0); if x.index < 0 error(geterr); @@ -20,7 +25,3 @@ nr = length(reactors); for i = 1:nr addReactor(x,reactors{i}); end - - - -