I am dealing with a very huge matrix and so wanted to use parallel computing in MATLAB to run in clusters. Here I have created a sparse matrix using:
Ad = sparse(length(con)*length(uni_core), length(con)*length(uni_core));
I have a written function adj
using which I can fill the matrix Ad
.
Every time the loop runs, from the function adj
I get a square symmetric matrix which is to be assigned to the Ad
from 3682*(i-1)+1
to 3682 *(i-1)+3682
in the first index and similarly in the second index. This is shown here:
parfor i = 1:length(con)
Ad((3682*(i-1))+1:((3682*(i-1))+3682), ...
(3682*(i-1))+1:((3682*(i-1))+3682)) = adj(a, b, uni_core);
end
In a normal for loop it is running without any problem. But in parfor
in parallel computing I am getting an error that there is a problem in using the sliced arrays with parfor
.