Hi @mmuetzel,

Thanks for the suggestion. I was able to successfully run the following program (taken from here):

```
% test_parrarrayfun_2_1.m
# Square root of the number of points where the function is calculated.
npo = 51;
# Dimensions of the integration domain
L = 10; xa = -L; xb = L; ya = -L; yb = L;
# Fist method, using two for loops, defining the function to calculate
# within the double loop.
INTENSITY_1=zeros(npo,npo);
tic
for m = 1:npo
xo = L*0.8*((2*(m-1)/(npo-1))-1);
for l = 1:npo
yo = L*0.8*((2*(l-1)/(npo-1))-1);
INTENSITY_1(m,l) = dblquad(@(x,y) integrando(x,y,xo,yo,L),xa,xb,ya,yb);
endfor
endfor
fprintf(1,'Hello!\n');
t1 = toc
# Second method, using pararrayfun to call Int_Num
pkg load parallel
range = linspace(-L*0.8,L*0.8,npo);
[xo,yo] = meshgrid(range);
tic
INTENSITY_2 = pararrayfun(4,@(xo,yo) Int_Num(xo,yo,L,xa,xb,ya,yb),xo,yo);
t2 = toc
fprintf(1,'Hello!!\n');
pkg unload parallel
```

The two functions, `integrando`

and `Int_Num`

, are saved separately in the working directory in which the `test_parrarrayfun_2_1`

sits.

```
# Function integrand definition
function intg = integrando(x,y,xo,yo,L)
intg = cos(((x-xo).^2 + (y-yo).^2)/L).^2;
endfunction
```

```
# Numerical integration definition
function res = Int_Num(xo,yo,L,xa,xb,ya,yb);
res = dblquad(@(x,y) integrando(x,y,xo,yo,L), xa, xb, ya, yb);
endfunction
```

The outputs printed on my computer screen looks like as follows:

```
>> test_parrarrayfun_2_1
Hello!
t1 = 2575.6
t2 = 1056.7
Hello!!
```

After this success, I tried running my own toy program, given below.

```
% simulate_function_2_1
pkg load parallel
% Main starts here
nmax=100;
tic
y=cell(nmax,1);
for ni=1:nmax
y{ni,1}=myFun(ni);
end
t1=toc
tic
ni=1:nmax; y=pararrayfun(4,@(i)myFun(i),ni);
t2=toc
```

As before, the two functions, `myFun`

and `logistic_map`

, are stored as separate m-files in the working directory.

```
function y = myFun(i)
n=10000; a=3.9; x0=0.1;
y{i,1} = logistic_map(n,a,x0);
end
```

```
function data = logistic_map( Total_time, a, x )
y=size(Total_time,1);
y(1,1)=x;
for i=2:Total_time
y(i,1)=y(i-1,1)*a*(1-y(i-1));
end
data{1,1}=y;
end
```

The outputs from the running of my toy program `simulate_function_2_1`

printed on my computer screen looks like as follows:

```
>> simulate_function_2_1
t1 = 8.3731
error: reshape: can't reshape 5050x1 array to 1x100 array
error: called from
parcellfun at line 261 column 21
pararrayfun at line 85 column 28
simulate_function_2_1 at line 12 column 13
```

What am I doing incorrectly?

Thanks for your help, as always.