changeset 909:ab1759166a8c feature/utux2D

Bugfix in InterfaceOptions.setOption
author Martin Almquist <malmquist@stanford.edu>
date Fri, 23 Nov 2018 20:21:28 -0800
parents ecfccf236af0
children b9c98661ff5d
files +multiblock/InterfaceOptions.m
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/+multiblock/InterfaceOptions.m	Fri Nov 23 20:14:16 2018 -0800
+++ b/+multiblock/InterfaceOptions.m	Fri Nov 23 20:21:28 2018 -0800
@@ -78,8 +78,15 @@
 
             % Both i and j are nonempty, set property only for that interface
             else
-                opts{i,j}{1} = setfield(opts{i,j}{1}, optStr, val);
-                opts{i,j}{2} = setfield(opts{i,j}{2}, optStr, val);
+                if ~isempty(opts{i,j})
+                    opts{i,j}{1} = setfield(opts{i,j}{1}, optStr, val);
+                    opts{i,j}{2} = setfield(opts{i,j}{2}, optStr, val);
+                elseif ~isempty(opts{j,i})
+                    opts{j,i}{1} = setfield(opts{j,i}{1}, optStr, val);
+                    opts{j,i}{2} = setfield(opts{j,i}{2}, optStr, val);
+                else
+                    error(sprintf('Blocks %d and %d do not seem to be coupled',i,j) );
+                end
             end
 
             obj.optsCell = opts;