Assistance needed to complete my application

4 views (last 30 days)
Hi folks, I am creating an puzzle (a game). This puzzle involves two applications designed using matlab. on the first app I have a set of images (basically peices of one image, shuffled). The game involves making the solving puzzle. once the images is solved and formes the meaning full images, then I need to stitch the images to a single image and set that to clipboard. I was able to combining, but I couldn't find a way to send it to the clipboard. I have tried out, "copygraphics" command but it has thrown some error. I have attached below. Can anyone help me get rid of this: Error using copygraphics Copying to clipboard is not supported in this environment.

Accepted Answer

Hari
Hari on 28 May 2024
Edited: Hari on 3 Sep 2024
Hi Madhavi,
I understand that you are developing a puzzle game using MATLAB, where the game involves shuffling and then reassembling image pieces to form a complete image. You encounter an error with the "copygraphics" command indicating that copying to the clipboard is not supported in your environment.
I assume you are using online version of MATLAB. "copygraphics" command is only supported in the MATLAB desktop environment, and is not supported in MATLAB Online or other web-based interfaces.
To resolve this issue, you can switch to the MATLAB desktop version where the "copygraphics" command is fully supported. This will allow you to copy figures, axes, or images directly to the clipboard without encountering the limitations present in the web version.
Here is a sample code to copy the combined image to the clipboard:
% Assuming 'combinedImage' is your reassembled image matrix
figure; % Create a new figure
imshow(combinedImage); % Display the image
% Optionally adjust figure properties here, e.g., set(gcf, 'Position', [100, 100, 600, 400]);
copygraphics(gcf); % Copy the figure to the clipboard
If you only need to work with MATLAB Online, follow the alternate approach:
Alternative Approach Using File Saving: Since the web version does not support clipboard interactions, save the image to a file and then download it. Use "imwrite(image, 'filename.png')" to save the image and then manually download the image to your system.
Displaying the Image for Manual Copy: Display the image within the MATLAB web interface for a manual screenshot. Display the image with "imshow(image)". Use your system's screenshot tool to copy the image.
To learn more about the limiations of "copygraphics" command in MATLAB Online, refer the documentation:
Hope this helps!

More Answers (0)

Categories

Find more on Just for fun in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!