Use batch within custom class A on a non-static method of custom class B

조회 수: 1 (최근 30일)
Andre Butzerin
Andre Butzerin 2020년 12월 15일
댓글: Andre Butzerin 2020년 12월 16일
I want to execute a non-static method of a custom class non-blocking/asynchronously from another class. Those 2 object are linked by their common parent object. The way I tried so far looks something like this:
classdef ClassA < handle
function non_blocking(self, varargin)
...
batch(@self.parent.ClassB.do_stuff, 0, {arg1_value,0,0,0,'arg2', arg2_value});
...
end
end
resulting in
Warning: Unable to calculate the dependencies of the files:
self.parent.ClassB.do_stuff
because:
File, function or class "self.parent.ClassB.do_stuff" may not exist. Neither WHICH nor EXIST could find an exact, case-sensitive match. Please check the spelling
of the name, and that any required directories are on the MATLAB path.
Any ideas or workarounds to fix this?
  댓글 수: 2
Raymond Norris
Raymond Norris 2020년 12월 16일
You might not need to resolve this warning. MATLAB isn't systematically going through do_stuff for additional functions to add to the job, but perhaps these files already exist on the worker's path.
Does the job run?
Andre Butzerin
Andre Butzerin 2020년 12월 16일
I maybe forgot to mention that self.parent is a App Designer app object..
But yes, it works now by using:
classB_obj = self.parent.ClassB;
batch(@classB_obj.do_stuff, 0, {arg1_value,0,0,0,'arg2', arg2_value});

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Downloads에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by