creating a spectrometer app

10 次查看(过去 30 天)
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 个评论
DGM
DGM 2023-12-13
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.
Ilay perez
Ilay perez 2023-12-13
编辑:Ilay perez 2023-12-13
I’m using instrument control toolbox to connect the spectrometer. The spectrometer is spectrasuit hr2000. In order to get the data into a variable I’m using ‘invoke’ function. The wavelengths on the x axis are constant and the intensity on the y axis changes according to the light that get into the spectrometer and the other parameters such as integration time. My question is more general then specific. I just want to know what is the correct way to create such a live plot.

请先登录,再进行评论。

采纳的回答

Brahmadev
Brahmadev 2023-12-27
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:
  1. 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
  2. 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!

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Instrument Control Toolbox 的更多信息

产品


版本

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by