Speed of Patch Color Update is dependent on Color.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hey there,
I'd like to create a patch field of a certain size (for simplicity let's assume it's 100 x 100 square patches) and change its color in a loop. To be more specific, the patch field has a standard color of e.g. black and I'd like to change the color of certain patches in a such a manner that it looks as if a line wanders from the top left corner to the bottom right one. The way I do it is that I create all patches first seperately and update the color of all patches afterwards in dedicated a loop and by using "drawnow". Very simple and it works just fine. But I discovered something weird, namely the runtime of the code to be somewhat dependet on the color of the line. I tested the code with a red only line and the display of it was smooth and fast. But with variable colors (at each state the color slightly changes its colors), the code is stuck after three updates (= line movements) and just ever so slowly updates the line position (e.g. from yellow to red in little steps). After maybe ten updates it speeds up again to full throttle. It strikes me that "drawnow" is responsible for it but it seems quite arbitrary to me. I checked the run time with the profiler in this section and every part has always about the same run time exept for the draw now part. The profiler doesn't tell why exactly it is taking longer in this area, 3 s compared to 0.2 s.
Does anybody have an idea as to why this happens and what I could do to prevent it?
Many thanks in advance.
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Startup and Shutdown en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!