Creating an active graph that allows variables to be updated in real time.
조회 수: 27 (최근 30일)
이전 댓글 표시
Hello
I am attempting to create a graph that I can update in real time. Currently I plot (see below) F vs D0. D0 pulls a single row from the variable TunabilityD3C and extracts a single point that I define. Here it is the 20th point in the row. It is this point I'd like to actively update. Right now I just manually change the point then rerun the script to regenerate the graph. I'd like to create a slider bar that will change the value of Freq within the range I set then have the graph update in real time as I do this.
Any help is apprieated.
F=[6 10 12 14 16];
Freq = 20;
D0=[TunabilityD3C(1,Freq),TunabilityD3C(2,Freq),TunabilityD3C(3,Freq),TunabilityD3C(4,Freq),TunabilityD3C(5,Freq)];
plot(F, D0,'rs-','LineWidth',2)
댓글 수: 0
답변 (1개)
Rik
2022년 4월 26일
편집: Rik
2022년 4월 26일
Plot once, and use the callback function of a slider to set the XData and YData properties of that object.
Don't forget to round the value property of the slider to an integer.
I suspect the indexing will be fast enough to just run that code every time. If not, you could pre-calculate the y values for all possible values of Freq and store that in an array.
For general advice and examples for how to create a GUI (and avoid using GUIDE), have look at this thread.
참고 항목
카테고리
Help Center 및 File Exchange에서 Discrete Data Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!