I use Matlabs plot function to create a comparison of two matrices (each 1300×1 double). The values are plotted in hundreds, because every hundred needs its own color and marker type.
It looks like this:
Start=1
for i=1:1:13
plot(ArrayA(Start:Start+99,1),ArrayB(Start:Start+99,1));
Start=Start+100;
end
I left out the parameters for marker and color for readibility.
It usually works fine, but sometimes, there is a special case where ALL the values in the matrices are equal to a certain scalar value (or at least some 1000 or so are and the rest 300 are equal to some other scalar). In these cases, we can be sure that values in ArrayA are equal to values in ArrayB element-by-element.
When this happens, whole matlab fails and gives me “Matlab System Error”. If you need details of this error, I am happy to provide it.
I am pretty sure this is linked to the points being equal and hence failing to plot correctly, as in other cases, it works just fine.
I would like to ask you for a suggestion for a workaround, as the solutions does not need to be very neat (as this happens very rarely).
try:
in the loop
OR, you can try defining 1 plot and setting the data everytime:
where X and Y are your respective data.