Single value in colors vector causes error in scatter plot
Afficher commentaires plus anciens
Hi,
I have the following code that works perfectly, the NaN values in the colors vector are skipped as desired:
>> colors = [NaN, 121, NaN, 150]
colors =
NaN 121 NaN 150
>> scatter([1,2,3,4], [1,2,3,4], 50, colors, 'filled');
which produces the following graph:

However, when i replace a value in the colors array with NaN it all goes wrong:
>> colors = [NaN, 121, NaN, NaN]
colors =
NaN 121 NaN NaN
>> scatter([1,2,3,4], [1,2,3,4], 50, colors, 'filled');
Warning: Error updating Scatter.
The logical indices contain a true value outside of the
array bounds.
Which stops the scatter graph from being plotted, it seems to happen when the vector is all NaN but one value.
Why does simply changing one of the values to NaN cause this error?
It doesn't matter which value is changed, but as soon as there is a single value surrounded by NaN's it will break.
Thanks in advance for any suggestions
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Orange dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
