Clear Filters
Clear Filters

Creating an update loop for a window

1 view (last 30 days)
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.

Answers (1)

Dinesh
Dinesh on 30 Jan 2024
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 Comments
Joseph Daynger Ruiz
Joseph Daynger Ruiz on 30 Jan 2024
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 on 30 Jan 2024
I have reran the code and the issue still persists on the current version of matlab online as of January 30th, 2024.

Sign in to comment.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!