Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Thread Subject:
Problems implementing batch/parfor/matlabpool

Subject: Problems implementing batch/parfor/matlabpool

From: PLH

Date: 18 Nov, 2010 13:39:04

Message: 1 of 2


I have a script my_func.m (see PS below for more details) that contains a parfor loop, and I'm trying to run it with batch. The script does not contain any parallel processing-related code except parfor, and,

> job1 = batch('my_func');

works as expected (because parfor just becomes the usual for, right?). However, when I try

> job1=batch(my_func',matlabpool,6); % max number of labs is 8

I obtain the following error:

Error in ==> matlabpool at 92

??? Output argument "varargout" (and maybe others) not assigned during call to "C:\Program

If I add the line "matlabpool open 6" before "parfor" and "matlabpool close" after "end" in my script, and run it from the editor window (i.e. not using batch) then it works.

Has anyone got any idea how I get this to work using batch please? Failing that, if someone could explain what the error means, then I'd be grateful. I've no doubt foolishly forgotten to supply some vital piece of the puzzle, so please ask if you need more info!!



The script my_func.m resembles:

a = 11; b =0.25; % + more scalar declarations up to f
N = 100;
vec = linspace(1,5,N);
mat = zeros(a,N);

parfor k=1:N
    mat(:,k) = my_func2(a,b,c,d,e,f,vec(k)); % output is a (aX1) vector.

Subject: Problems implementing batch/parfor/matlabpool

From: Edric M Ellis

Date: 19 Nov, 2010 15:41:57

Message: 2 of 2

"PLH " <> writes:

>> job1=batch(my_func',matlabpool,6); % max number of labs is 8

That should be:

job1=batch('my_func', 'matlabpool', 6);

I.e. the string 'matlabpool' is a parameter to the 'batch' command.



Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us