好的
function varargout = gui_grid1(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @gui_grid1_OpeningFcn, ...
'gui_OutputFcn', @gui_grid1_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 gui_grid1_OpeningFcn(hObject, eventdata, handles, varargin)
set(handles.x_edit,'String','3');
set(handles.y_edit,'String','3');
set(handles.z_edit,'String','3');
set(handles.a_edit,'String','1');
set(handles.b_edit,'String','1');
set(handles.c_edit,'String','1');
handles.output = hObject;
guidata(hObject, handles);
h= axes('Color',[.9 .9 .9],...
'GridLineStyle','--',...
'ZTickLabels','0',...
'FontName','times',...
'FontAngle','italic',...
'FontSize',14,...
'XColor',[0 0 .7],...
'YColor',[0 0 .7],...
'ZColor',[0 0 .7]);
function varargout = gui_grid1_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
function play_pushbutton_Callback(hObject, eventdata, handles)
x=str2num(get(handles.x_edit,'String'));
y=str2num(get(handles.y_edit,'String'));
z=str2num(get(handles.z_edit,'String'));
a=str2num(get(handles.a_edit,'String'));
b=str2num(get(handles.b_edit,'String'));
c=str2num(get(handles.c_edit,'String'));
m=x/a;
n=y/b;
p=z/c;
g=m*n*p;
h=(m-1)*n*p+m*(n-1)*p+m*n*(p-1);
j=(m-1)*(p-1)*n+(n-1)*(p-1)*m+m*(p-1)*(n-1);
l=(m-1)*(n-1)*(p-1);
set(handles.dots,'String',strcat('',num2str(g)));
set(handles.lines,'String',strcat('',num2str(h)));
set(handles.planes,'String',strcat('',num2str(j)));
set(handles.cubes,'String',strcat('',num2str(l)));
d=moviein((m-1)*n*p+(n-1)*m*p+(p-1)*n*m)
for z=0:(p-1)
for y=0:(n-1)
for k=0:(m-2)
x=k:0.01:k+1;
plot3(x,y,z);
hold on;
d(:,k+1+y*k+y*k*z)=getframe;
end
end
end
for z=0:(p-1)
for x=0:(m-1)
for e=0:(n-2)
y=e:0.01:e+1;
plot3(x,y,z);
hold on;
d(:,(m-1)*n*p+e+1+x*e+e*x*z)=getframe;
end
end
end
for y=0:(n-1)
for x=0:(m-1)
for f=0:p-2
z=f:0.01:f+1;
plot3(x,y,z);
hold on;
d(:,(m-1)*n*p+(n-1)*m*p+f+1+f*x+f*x*y)=getframe;
end
end
end
movie(d);
function close_pushbutton_Callback(hObject, eventdata, handles)
close
function x_edit_Callback(hObject, eventdata, handles)
function x_edit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function y_edit_Callback(hObject, eventdata, handles)
function y_edit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function z_edit_Callback(hObject, eventdata, handles)
function z_edit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function a_edit_Callback(hObject, eventdata, handles)
function a_edit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function b_edit_Callback(hObject, eventdata, handles)
function b_edit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function c_edit_Callback(hObject, eventdata, handles)
function c_edit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function dots_Callback(hObject, eventdata, handles)
function dots_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function planes_Callback(hObject, eventdata, handles)
function planes_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function cubes_Callback(hObject, eventdata, handles)
function cubes_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function lines_Callback(hObject, eventdata, handles)
function lines_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end