Creating an update loop for a window

조회 수: 3 (최근 30일)
Joseph Daynger Ruiz
Joseph Daynger Ruiz 2022년 5월 26일
댓글: Joseph Daynger Ruiz 2024년 1월 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.

답변 (1개)

Dinesh
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.
  댓글 수: 2
Joseph Daynger Ruiz
Joseph Daynger Ruiz 2024년 1월 30일
Hello Dinesh,
I am still curious about how to solve the issue. I have not tried my code in a while and I am a bit busy this week. Would you be all right if I ran it this friday and got back to you to see if it worked or not on the latest version of matlab online?
Joseph Daynger Ruiz
Joseph Daynger Ruiz 2024년 1월 30일
I have reran the code and the issue still persists on the current version of matlab online as of January 30th, 2024.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by