Associating plotted data with color and size sources in MATLAB

This question is related to the question under discussion here , in which I outline a problem I ran into regarding quickly rendering 3D scatter data in MATLAB during simulation. (Code examples and data are also provided here.)

As an alternative to setting the properties of XData

, YData

, ZData

, SizeData

and CData

the graph 3D-scattering in MATLAB I wonder if having all possible relevant sources of dynamically linked with the points that are plotted 3D-scatter. The associated values ​​will be buffered and displayed periodically (say every 0.5s). From what I understand, the sources are updated in the background, so graphs with associated data don't slow down the simulation. From what I can see in the documentation, only XDataSource

, YDataSource

and are specified ZDataSource

. It is also possible to dynamically link size and color data sources, and if not, is there an easy workaround?

As a reminder, I am using MATLAB R2016a for Windows 7.

+3


source to share


1 answer


It is also possible to dynamically link size and color data sources, and if not, is there an easy workaround?

Yes it is possible using named properties

  • SizeDataSource

  • CDataSource

These properties are assigned row names for the variables that you want to bind for update. Then, upon binding, subsequent updates to those named variables will be reflected in your graphs in half a second or so (faster).

But there is a big caveat here with your specific example.



Fields xxxxSource

are usually initialized from the beginning when a graphics handle is created. This will be in your initial calls scatter3

.

The problem is that you have eight separate markup descriptors, each referring to the same variable (s) but with different indices. That is, you update the indices of these variables to create your images.

Another way to use a parameter reference here would be to create eight different variable names and bind each to the appropriate handle to the markup plot.

I think a cleaner solution is to use a timer callback to update things at a given time interval.

0


source







All Articles