Running a UI based function on a separate worker.
Show older comments
Hey all, I have a matlab function that opens a user interactive window and takes some inputs from the user and does some calculation which are displayed only on interactive window itself(no outputs). The calculations take a lot of time so I tried running it as a batch but ended up with the following error,
The script or function that will be called on the worker must be a single string or function handle.
Any ideas as to what the problem might be? Just to be clear, I am calling a single function in the batch but that function in itself calls other functions.
Answers (1)
Walter Roberson
on 19 Dec 2016
0 votes
Your slightly later Question http://www.mathworks.com/matlabcentral/answers/317430-input-argument-error-while-running-a-batch-function suggests that you were calling batch() incorrectly, but it is difficult for us to be sure as you did not post your code.
7 Comments
hemant
on 19 Dec 2016
Walter Roberson
on 19 Dec 2016
The syntax
@ folder1.folder2.func1
is not valid, not unless folder1 is created as a "package" and folder2 is created as a package within the first package. That would require that the directory structure be
+folder1/+folder2/func1.m
where the '+' are literal parts of the directory name.
You cannot use @ to create a function handle to an arbitrary location: other than with packages, you can only create handles to functions that are on your path.
hemant
on 19 Dec 2016
José-Luis
on 19 Dec 2016
Famous last words...
Walter Roberson
on 19 Dec 2016
I suggest experimenting with
funcHandle = @(x) folder1.folder2.func1(x)
hemant
on 19 Dec 2016
Walter Roberson
on 19 Dec 2016
Can you zip up your code and attach it?
Categories
Find more on Desktop in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!