Images for real time spectrogram: how to change CData partially in an efficient way?
6 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a GUI application that samples and displays 24 channels at 12 kHz. The application can also calculate and plot the FFT's (1024,2048 points) in real time. Thanks to the set(plot1,'Xdata',x,'Ydata',y) command, my plots update pretty fast.
Now, I want to implement a 24 channel spectrogram view. As you can imagine, this is amazingly time- and memory-consuming. I had in mind placing 24 image-views and doing something similar by using the set(image1,'Cdata', spec) command. What I don't like, is that each 'spec' variable has to be an MxN matrix, while I only need to update 1 column at each time!
Is there some way to change ONLY ONE COLUMN of CData?
I saw there is a colors=get(image1,'CData') function, where I can retrieve the CData matrix, modify it, and then place it back into the 'CData property'. I haven't tried it yet, but I'm afraid that moving the whole image back and forth takes a lot of time.
Could somebody give me an advice?
1. How can I partially alter "CData"? 2. Is the "get" command my only alternative? 3. Is it fast/efficient enough for my spectrogram application?
Kind regards, Oscar
0 个评论
回答(2 个)
Walter Roberson
2011-9-20
get(), modify, set(), is the only supported mechanism.
There might possibly be mechanisms in the private details of how handle graphics work, or there might possibly be mechanisms involving Java methods.
0 个评论
Patrick Kalita
2011-9-21
Don't assume you have a performance problem before you do. Try the C = get(image1, 'CData'), modify C, set(image1, 'CData', C) workflow first and see whether it is fast enough for your application.
If it is too slow, it is possible that you could break up the image into several smaller images. For instance, instead of one 1024x2048 image you could have sixteen 1024x128 images. Now you're moving around a smaller array when you need to do an update. The cost is that you need to do some extra bookkeeping to know which image to update and you'll need to setup the XData and YData of each image appropriately so they all line up nicely.
I haven't tried this out, so I don't make any guarantees. It's just an idea.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!