4545import matlabcontrol .extensions .MatlabNumericArray ;
4646import matlabcontrol .extensions .MatlabTypeConverter ;
4747
48+ import org .scijava .log .LogService ;
4849import org .scijava .options .OptionsService ;
4950import org .scijava .plugin .Parameter ;
5051
@@ -58,6 +59,9 @@ public class MATLABBindings implements Bindings {
5859 @ Parameter
5960 private OptionsService optionsService ;
6061
62+ @ Parameter
63+ private LogService logService ;
64+
6165 @ Override
6266 public int size () {
6367 return getVars ().length ;
@@ -122,7 +126,7 @@ public Object put(final String name, final Object value) {
122126 return value ;
123127 }
124128 catch (final MatlabInvocationException e ) {
125- System . err . println ( e . getStackTrace () );
129+ logService . warn ( e );
126130 }
127131 }
128132
@@ -131,7 +135,7 @@ public Object put(final String name, final Object value) {
131135 return value ;
132136 }
133137 catch (final MatlabInvocationException e ) {
134- System . err . println ( e . getStackTrace () );
138+ logService . warn ( e );
135139 }
136140
137141 return null ;
@@ -182,15 +186,15 @@ private Object retrieveValue(final Object key, final boolean remove) {
182186 v = converter .getNumericArray (k );
183187 }
184188 catch (final MatlabInvocationException e ) {
185- System . err . println ( e . getStackTrace () );
189+ logService . warn ( e );
186190 }
187191
188192 try {
189193 v = proxy .getVariable (k );
190194 if (remove ) proxy .eval ("clear " + k );
191195 }
192196 catch (final MatlabInvocationException e ) {
193- System . err . println ( e . getStackTrace () );
197+ logService . warn ( e );
194198 }
195199
196200 return v ;
0 commit comments