I have the following MATLAB code that I want to run it by using parfor:
max = -1;
for i = 1:10
for j = (i+1):10
X = my_function(i, j);
if (X > max)
max = X;
end
end
end
disp(max)
I want to change the first for to parfor. I read couple of tutorials and the documentation, but I don't know how to have the same result for max, by using parfor.
I know that there is some problem with the usage of i in for j = (i+1):10.
I would appreciate any suggestion.
Xvalues in an array and find themaxafterwards. It's also a very bad idea to name a variable the same as a built-in function. It makes using the function again a bit of a pain. - beaker