creating a spectrometer app

7 Ansichten (letzte 30 Tage)
Ilay perez
Ilay perez am 13 Dez. 2023
Kommentiert: Ilay perez am 29 Dez. 2023
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 Kommentare
DGM
DGM am 13 Dez. 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.
Ilay perez
Ilay perez am 13 Dez. 2023
Bearbeitet: Ilay perez am 13 Dez. 2023
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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Brahmadev
Brahmadev am 27 Dez. 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:
  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!

Weitere Antworten (0)

Kategorien

Mehr zu Instrument Control Toolbox finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by