Why MATLAB throws an error even if it shouldn't go to the first case of the switch statement? Below is the minimal example:
mycase = 2;
non_crack_bytes = 1:6000;
syn_crack_bytes = 1:10000;
imgCount = 10000;
parfor j = 1 : imgCount
switch mycase
case 1
if ~(non_crack_bytes(j) == 0)
% Do something
else
continue;
end
case 2
if ~(syn_crack_bytes(j) == 0)
% Do something
else
continue;
end
end
end
The error I am getting is:
Error using ScratchPaperFile>(parfor supply)
Index exceeds the number of array elements (6000).
Error in ScratchPaperFile (line 10)
parfor j = 1 : imgCount