creating a spectrometer app
10 views (last 30 days)
Show older comments
I'm trying to build a matlab app to control spectrometer and other instruments simultaneously.
I'm still new to to this and it's going very slow.
My main problem now is seeing the data in a live plot.
For example: If I'm moving a light source back and forth from the spectrometer I want to see the change in the light intensity as I move the light source with out plotting it manually again and again.
If any one could shed light on how to create such a live plot it would be very helpful. I tried to do it with a loop that updates the y axis but it didn't work.
thanks.
2 Comments
DGM
on 13 Dec 2023
We don't know anything about the features or interfaces of your spectrometer, how you're getting data from it, or what form that data takes. Consequently, we have no idea why what you tried didn't work. You'll have to provide more information.
Accepted Answer
Brahmadev
on 27 Dec 2023
As per my understanding, the spectrometer app that you have created is calling the "plot" function for drawing each new iteration of data that is recieved from the spectrometer. If the data is large and the "plot" or similar functions are called repeatedly, this can cause the app to become slow. As an alternative, if the entire data is not changing at each data point, it can be useful to update just the part of the data that has changed.
Some other things to consider are:
- The "drawnow" can be used to flush the event queue and update the figure window immediately without waiting for the loop to end. Also, "drawnow limitrate" can be used to limit the number of updates to 20 frames per second. Refer to the following MathWorks documentation for more information: https://www.mathworks.com/help/matlab/ref/drawnow.html
- On the other hand, you can update the plot less frequently by using a conditional statement or by inserting a "pause" command to control the update rate. Refer to the following MathWorks documentation for more information: https://www.mathworks.com/help/matlab/ref/pause.html
Hope this helps in resolving your query!
More Answers (0)
See Also
Categories
Find more on Instrument Control Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!