How do I save the whole matlab gui panel? - matlab-guide

I can save a particular figure or an axes by using export_fig procedure. The command used is like the following:
export_fig(handles.Myfigure, filename). % This code is available on line
But I am trying to save a copy of the main gui (like a screen shot of the whole for record keeping). I guess this could work if I knew the handle of the main panel.
Can anyone help?
Thanks

http://www.mathworks.com/help/techdoc/ref/getframe.html
Get coords of window and dimensions and pass it to this function.

Related

P3D sketch not working in Python mode of Processing

I was translating a Java sketch to a Python sketch in Processing. It is using the P3D engine and it is not showing anything in the window while it is showing what I want in Java mode. When I run it just shows a blank black window instead of a grid. I can change its background color but I can not draw in the shapes or something window. Please help me! And I can not share its code as it is not an open source project.
It was my fault. It was a mistake in the code. I was making the grid using for loop and the variables that were needed for for loop were not defined properly it was not giving an error because the value of variables was 0. Sorry for wasting your time. Enjoy!

How to set image in axes in matlab GUI?

i have a code which gives several images as ouput and i want to set all these images in particular axes in GUI in matlab. I'm trying to make a GUI of the code.
For eg.
figure,imshow(s1);
figure,imshow(s2);
figure,imshow(s2&s1);
and i want to set the output image of first command in, say axes3, output image of second command in axes4 and similarly last output image in axes5.
Although i know i need to use
set(handles.axes...)
command but i don't know the exact syntax on how to make the image be shown in particular axes.
Please give explain on how to make this happen with any suitable example. Thanks in advance.
One line solution (for each image) is to set the axis as the parent of the image within the imshow command;
imshow(image_Data,'Parent',handles.axes1)
There should be no need to open the additional figure windows ( assuming the axes are with the gui...)
So specifically for the question above:
imshow(s1,'Parent',handles.axes3);
imshow(s2,'Parent',handles.axes4);
imshow(s2&s1,'Parent',handles.axes5);
First you should create an axes box in your gui, then in tag section get a name i.e. (original) and finaly in editor when you want to use it code something like this
A = imread (Path);
axes(handles.original);
imshow(A);
I hope to help you...

Overidding imshow

When I use the following,
imshow(imread('image1.jpg'));
imshow(imread('image2.jpg'));
imshow(imread('image3.jpg'));
imshow(imread('image4.jpg'));
imshow(imread('image5.jpg'));
imshow(imread('image6.jpg'));
I got only image named image6.jpg in the output figure.
There is also an option figure,imshow(...); to view all the images each in new window.
But writing figure in each line where I need to view the image is a repeated and tedious process. Is there any other solution to get the same output as with figure,imshow(..);
without using figure function.
I mainly put on this question because while programming a lot somewhere we forget to use the figure function and so the image that we need to view wont be visible. It would have been overwritten by other image. So provide me some solution.
I ask this only for simplicity in writing the code. So if there is any solution, please mention.
Thanks in advance.
I'm not sure, but I don't think that there's a workaround to that. MATLAB basically changes the current figure handle to that of a new image when you use imshow. One thing you can do however is to make a copy of imshow in your local directory and edit it accordingly to make your own UDF.
What I would recommend however (so as to preserve functionality across systems) is that you open your code is an editor and replace all imshows with figure, imshow. This should be easy enough and it'll be easy to revert back as well.

Matlab GUI: migrate a plot to a new window

I've encountered such a problem, and hope you guys could help me out here.
I have a plot in my GUI, contained multiple lines with different linspecs and a group of legends.
And I've made a context menu which should allow users to open the EXACTLY same plot(retaining all line settings, title, legends, and so forth) in a new window(default figure, where it is able to save/edit the figure).
However I couldn't find a simple way to migrate the plot, except re-run the plot commands which is quite complicated(plot different data, etc.)
So, I am looking for the solution in the following two ways:
is there a simple way to migrate the plot into new figure window?
or is it possible to save the plot directly with current interface?
For 2, I'd like to clarify that I only want to save the plot, not all GUI interface. I've tried saveas(handle.Plot,...) but it saved the GUI interface as an entity.
I hope the point has been made clear, thanks for your time. Cheers.
For this task you can probably use the builtin Matlab function copyobj which does exactly this (i.e. the first option mentionned in your question).
The following piece of code demonstrates its usage:
h1=figure;
a1=plot((1:100),rand(1,100),'r-');
hold on
plot((1:100),rand(1,100),'b+');
legend({'plot1';'plot2'});
h2=figure;
copyobj(get(h1,'children'),h2);
Hope it works as well in your case.
UPDATE: as far as I understand this, your second solution would involve the saveas function which unfortunately works with the figure environment and not with axes (as you experienced it). So a workaround would probably involve copying the desired axes to a new figure with the method given above and then use saveas.

Matlab GUI using getappdata and setappdata

Basically what I want to do is have one gui that is just a title and a push button that calls uigetfile(), and once the user selects an image, the gui closes, and opens a new gui that contains the image, functions applied to the image, and information about the image. I have made all the code for everything, I just can't figure out how to use setappdata and getappdata so that the new gui opens with everything I want.
Mathworks website contains detailed information for most of matlabs functions.

Resources