radiobutton to switch between scatter3 datasets?
Afficher commentaires plus anciens
I would like to extend the vizualisation in my scatter3 project to inGamut colors. Right now, what I have is this :

The points represent the unconverted sRGB colors in Lab. The data tip shows both these Lab coordinates and how far they are relative to the Destination gamut. But I would like to have a radio button that would toggle between the unconverted sRGB "Lab" colors and the converted colors, once converted with applycform to the Desination gamut. Based on my experience with the Opacity slider control, I figure my code to add this functionality could be as follows :
% First, define the control
uicontrol('Style', 'radiobutton', ______, 'Callback', {@radiobuttonCB, h}); % h is the handle of the scatter3 figure
% Then, the callback
function radiobuttonCB(SliderH, EventData, h)
h=scatter3(LabIN(2,:),LabIN(3,:),LabIN(1,:),80,RGB,'fill', 'MarkerEdgeColor', [0,0,0], 'Linewidth', 1.3);
end
The initial scatter3 function is this :
h=scatter3(Lab(2,:),Lab(3,:),Lab(1,:),80,RGB,'fill', 'MarkerEdgeColor', [0,0,0], 'Linewidth', 1.3);
I'm not sure I can simply 're-call' the scatter3 with the new X,Y, Z parameters? How should I proceed?
And then, I'll to come up with some logic to toggle back to the original Lab data... Oh boy!
1 commentaire
Roger Breton
le 23 Déc 2021
Réponse acceptée
Plus de réponses (1)
Cris LaPierre
le 23 Déc 2021
0 votes
Right now, your color is set by your variable RGB (which appears to be undefined in the callback function you have shared). So long as this variable gets updated with your desired colors, yes, you can just re-call the bSelection function.
However, we are unaware of what other code may exist inside this callback function. Whether this is the right approach or not will have to be decided by you after taking that into consideration.
12 commentaires
Roger Breton
le 23 Déc 2021
Cris LaPierre
le 23 Déc 2021
Just to be clear, RGB is just a variable. You are using it to specify the 'Color' property when you create the figure.
Consider sharing your app and data if you can (attach using the paperclip icon) so that we can help specifically with your application.
Roger Breton
le 23 Déc 2021
Cris LaPierre
le 23 Déc 2021
Your callbacks are all functions, so any variables created inside a function are lost when the function ends. The exception to this in an app are variables that are created as properties of the app.
Roger Breton
le 23 Déc 2021
Roger Breton
le 23 Déc 2021
Cris LaPierre
le 23 Déc 2021
Roger Breton
le 23 Déc 2021
Roger Breton
le 23 Déc 2021
Cris LaPierre
le 23 Déc 2021
Modifié(e) : Cris LaPierre
le 23 Déc 2021
Roger Breton
le 23 Déc 2021
Modifié(e) : Roger Breton
le 23 Déc 2021
Roger Breton
le 23 Déc 2021
Catégories
En savoir plus sur Interactive Control and Callbacks 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!

