Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
How to use two sliders logarithmically spaced to update the plot on the same figure as the sliders are moved?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello all, I am facing quite a problem with the usage of sliders. I have created a function which takes two inputs a and b, and accordingly, returns x and y. I plot x and y on a log-log axis to see how the output behaves.
Now I want to create two sliders for a and b spaced logarithmically, so by moving both of the sliders, I can see how the plot changes. I want to update my current figure with the change in a and b through the sliders.
I am at my wit's end on how to solve this problem and I would greatly acknowledge help from the people here.
Thanks, Subharthi
4 Kommentare
Jan
am 27 Aug. 2017
Bearbeitet: Jan
am 27 Aug. 2017
The slider works with a linear range and steps only, but it is trivial to calculate the exponentional (not logarithm):
uicontrol('Style', 'Slider', 'Min', 0, 'Max', 3, ...
'SliderStep', [0.1, 0.1], ...
'Callback', @SliderCallbackA);
...
function SliderCallbackA(SliderH, EventData)
Value = get(SliderH);
a = 10 ^ Value;
disp(a)
... now do with a what you want:
updateDiagram('a', a);
% And in the other slider callback:
% updateDiagram('b', a);
end
Creating two sliders works exactly as creating one slider, only do it twice. Perhaps you want to share the values of a and b in the handles struct. Search for "share variables between callbacks" in the forum.
You did not provide any code yet, therefore my "updateDiagram" is a bold guess only. Again: Please post, what you have tried so far, such that suggesting the further steps does not require to guess the complete code.
Antworten (0)
Diese Frage ist geschlossen.
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!