Creating an update loop for a window
2 次查看(过去 30 天)
显示 更早的评论
The goal is to create a window that allows for painting 8-bit grey scale images to understand morphological operations on images.
Things that I have found. This matlab code for a Paint-like program in matlab performs almost exactly the way I imagine (https://www.mathworks.com/matlabcentral/fileexchange/70372-matlab-paint). The problem is that when run on a matlab online environment the overrides for the left and mouse buttons are ignored. This results in a figure being displayed in another window, but the image is unchanged by left or right mouse button inputs. On another note there is a way to have a listener added to a button press and have some code run (https://stackoverflow.com/questions/56259686/set-matlab-windowbuttondownfcn-and-preserve-default-behavior). This means I can have a window up and when I click with a mouse button the position of the mouse is retrived and I can have a function run and chage the array of 8-bit ints acordingly. The problem is that this change to the array does not update in the window.
So all that is left is to combine these two things and find a way to update the windows graphics. Another constraint is that in the project I am working with someone who runs a linux computer and I run a windows computer. Therefore to prevent inconsistent environments I hope to be able to accomplish this in the matlab online environment in a chrome browser. the browser is not fixed so if chrome is somehow causing the issue that can be changed.
So is there a way to override or add an update function for a figure window, or is there another type of window that also has an update loop. A bonus would be a window that lets you control the displayed pixels in the window every loop or so (ie controlling the image buffers directly).
EDIT 1:
The whole idea woks when I run it on an installed version of matlab. I am not sure what functions differ when being called on matlab online.
0 个评论
回答(1 个)
Dinesh
2024-1-30
Hello Joseph,
Running interactive graphics applications like a Paint-like program in MATLAB Online can indeed be a bit more challenging due to possible limitations in how MATLAB Online handles graphics and user interactions compared to the desktop version.
In the desktop version of MATLAB, you can capture mouse events directly within the figure window and manipulate the graphics objects in real-time. However, MATLAB Online may not support all interactive features due to the web-based interface and how mouse events are managed in a browser environment.
Since it's been more than 1.5 years, the issue might have been fixed now. If you still face the issue with the latest MATLAB Online version, then please let me know and I will look into the issue further.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!