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)
This commit is contained in:
Ray Speth 2012-03-24 01:33:54 +00:00
parent 4feb983688
commit c56bfab0ed

View file

@ -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