1.软件版本
matlab2017b
2.核心代码
function varargout = Tops(varargin)
% TOPS MATLAB code for Tops.fig
% TOPS, by itself, creates a new TOPS or raises the existing
% singleton*.
%
% H = TOPS returns the handle to a new TOPS or the handle to
% the existing singleton*.
%
% TOPS('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in TOPS.M with the given input arguments.
%
% TOPS('Property','Value',...) creates a new TOPS or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Tops_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Tops_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help Tops
% Last Modified by GUIDE v2.5 04-Apr-2013 07:31:51
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Tops_OpeningFcn, ...
'gui_OutputFcn', @Tops_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
% End initialization code - DO NOT EDIT
% --- Executes just before Tops is made visible.
function Tops_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to Tops (see VARARGIN)
% Choose default command line output for Tops
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes Tops wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = Tops_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
parameter;
SIZE = str2num(get(handles.edit2,'string'));
[filename,pathname]=uigetfile({'*.jpg';'*.bmp';'*.gif'},'选择图片');
if isequal(filename,0)
disp('Users Selected Canceled');
else
str=[pathname filename];
I0 = imread(str);
I1 = imresize(I0,[SIZE,SIZE]);
axes(handles.axes1);
imshow(I1);
end;
fqs = fq;
qvals = qval;
Dqs = Dq;
function edit3_Callback(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit3 as text
% str2double(get(hObject,'String')) returns contents of edit3 as a double
% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit5_Callback(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
parameter;
fid = fopen('save_alpha.txt','wt');
for i = 1:length(aqs)
fprintf(fid,'%f\n',aqs(i));
end
fclose(fid);
fid = fopen('save_falpha.txt','wt');
for i = 1:length(fqs)
fprintf(fid,'%f\n',fqs(i));
end
fclose(fid);
fid = fopen('save_Q.txt','wt');
for i = 1:length(qvals)
fprintf(fid,'%f\n',qvals(i));
end
fclose(fid);
fid = fopen('save_D.txt','wt');
for i = 1:length(Dqs)
fprintf(fid,'%f\n',Dqs(i));
end
fclose(fid);
3.操作步骤与仿真结论
运行tops.m文件。会得到如下的结果:
图片测试为:
A09-34
标签:多重,see,gui,Tops,handles,hObject,分形,MATLAB,fid From: https://www.cnblogs.com/matlabfpga/p/16920457.html