Question about creating a GUI

6 次查看(过去 30 天)
So I have the function for the mandelbrot set, and I also have a script to create a GUI. I cannot figure out how to get the image from the mandelbrot set to appear as the image in my GUI. Any help would be greatly appreciated.
Here is the script for the GUI:
function varargout = madelbrotset_gui(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @madelbrotset_gui_OpeningFcn, ...
'gui_OutputFcn', @madelbrotset_gui_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
function madelbrotset_gui_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
guidata(hObject, handles);
function varargout = madelbrotset_gui_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
function reset_button_Callback(hObject, eventdata, handles)
function zoom_out_button_Callback(hObject, eventdata, handles)
function zoom_in_button_Callback(hObject, eventdata, handles)
function pan_up_button_Callback(hObject, eventdata, handles)
function pan_left_button_Callback(hObject, eventdata, handles)
function pan_right_button_Callback(hObject, eventdata, handles)
function pan_down_button_Callback(hObject, eventdata, handles)
end
end
end
end
end
end
end
end
end
end
here is the script for mandelbrot set:
clc
xmin=-1.5;
xmax=1;
ymin=-1.5;
ymax=1.5;
map=mandelset(xmin,xmax,ymin,ymax);
figure(1)
imagesc(map)
colormap(jet)
while(1)
disp('click the top left')
[x1,y1]=ginput(1)
disp('now click the bottom right')
[x2,y2]=ginput(1)
yminnew=(ymax-ymin)/511*y1+ymin;
xminnew=(xmax-xmin)/511*x1+xmin;
ymaxnew=(ymax-ymin)/511*y2+ymin;
xmaxnew=(xmax-xmin)/511*x2+xmin;
map=mandelset(xminnew,xmaxnew,yminnew,ymaxnew);
figure(1);
imagesc(map)
colormap(jet)
xmin=xminnew;
xmax=xmaxnew;
ymin=yminnew;
ymax=ymaxnew;
end

采纳的回答

Walter Roberson
Walter Roberson 2013-3-22
You do not appear to have a button to start the drawing. When you create that button, in the callback for that button, place a line that just has on it the name of the script. For example if the script file name is "do_the_mandel.m" then a line in the callback would be
do_the_mandel
This will cause the image to appear as a figure in your GUI.
Note: if you do not want the script to erase everything else in your GUI, then precede the script name with "hold on", as in
hold on
do_the_mandel

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Object Properties 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by