error in LINE 1 " function varargout = Final_gui(varargin) " ,while converting the code to C ,how do i fix it

5 views (last 30 days)
function varargout = Final_gui(varargin)
% FINAL_GUI M-file for Final_gui.fig
% FINAL_GUI, by itself, creates a new FINAL_GUI or raises the existing
% singleton*.
%
% H = FINAL_GUI returns the handle to a new FINAL_GUI or the handle to
% the existing singleton*.
%
% FINAL_GUI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in FINAL_GUI.M with the given input arguments.
%
% FINAL_GUI('Property','Value',...) creates a new FINAL_GUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Final_gui_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Final_gui_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 Final_gui
% Last Modified by GUIDE v2.5 20-Jan-2017 11:56:10
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Final_gui_OpeningFcn, ...
'gui_OutputFcn', @Final_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
% End initialization code - DO NOT EDIT
% --- Executes just before Final_gui is made visible.
function Final_gui_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 Final_gui (see VARARGIN)
% Choose default command line output for Final_gui
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes Final_gui wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = Final_gui_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)
[file path] = uigetfile({'*.jpg';'*.png';'*.tif'},'Select a Color Image');
if(path)
inp_img=imread([path file]);
axes(handles.axes1)
imshow(inp_img);title('Input Image','FontName','cambria','FontSize',10)
if(size(size(inp_img),2)>2)
gray_img=rgb2gray(inp_img);
else
gray_img=inp_img;
end
end
handles.gray_img=gray_img;
guidata(hObject, handles);
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
gray_img=handles.gray_img;
psi = fspecial('gaussian',3,0.5);
g_gray_img = imfilter(gray_img, psi);
I=gray_img;
I_cap=g_gray_img;
% subplot(1,2,1),imshow(I),title('Original');
axes(handles.axes2)
imshow(I_cap);title('Gaussian Image','FontName','cambria','FontSize',10);
[Qg,Qch]=blindimagequality(I_cap,2,2,60,'degree');
set(handles.edit8,'string',Qg)
psnr_v = psnr( I,I_cap );
set(handles.edit1,'string',psnr_v)
ad_v = ad( I,I_cap );
set(handles.edit2,'string',ad_v)
mse_v = mse( I,I_cap );
set(handles.edit3,'string',mse_v)
nae_v = nae( I,I_cap );
set(handles.edit4,'string',nae_v)
sc_v = sc( I,I_cap );
set(handles.edit5,'string',sc_v)
snr_v = snr( I,I_cap );
set(handles.edit6,'string',snr_v)
md_v = md( I,I_cap );
set(handles.edit7,'string',md_v)
feat=[psnr_v,ad_v,mse_v,nae_v,sc_v,snr_v,md_v];
figure,
plot(feat);grid on
xlabel('Features Set'),ylabel('Feature Value'),title('Features');
% msgbox(strcat('Features Set=',num2str(feat)));
handles.feat=feat;
guidata(hObject, handles);
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
feat=handles.feat;
res=dir('*.mat');
for fid=1:size(res,1)
load (res(fid).name);
nam{fid}=res(fid).name;
if fid==1
train1=quality(1).feat;
for j=2:length(quality)
train1=[train1;quality(j).feat];
end
group=ones(length(quality),1)*fid;
else
for j=1:length(quality)
train1=[train1;quality(j).feat];
end
group=[group;ones(length(quality),1)*fid];
end
end
svmStruct = svmtrain(train1,group);
class = svmclassify(svmStruct,feat);
if(class==1)
msgbox('It is a Fake Biometric','Biometric Checking')
else
msgbox('It is a True Biometric','Biometric Checking')
end
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a=[];
set(handles.edit1,'string',a)
set(handles.edit2,'string',a)
set(handles.edit3,'string',a)
set(handles.edit4,'string',a)
set(handles.edit5,'string',a)
set(handles.edit6,'string',a)
set(handles.edit7,'string',a)
set(handles.edit8,'string',a)
axes(handles.axes1);cla
axes(handles.axes2);cla
clc;
clear all;
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close(handles.figure1)
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (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 edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (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 edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (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 edit2 as text
% str2double(get(hObject,'String')) returns contents of edit2 as a double
% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (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 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 edit4_Callback(hObject, eventdata, handles)
% hObject handle to edit4 (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 edit4 as text
% str2double(get(hObject,'String')) returns contents of edit4 as a double
% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (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)
% 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 edit5 as text
% str2double(get(hObject,'String')) returns contents of edit5 as a double
% --- Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit5 (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 edit6_Callback(hObject, eventdata, handles)
% hObject handle to edit6 (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 edit6 as text
% str2double(get(hObject,'String')) returns contents of edit6 as a double
% --- Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit6 (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 edit7_Callback(hObject, eventdata, handles)
% hObject handle to edit7 (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 edit7 as text
% str2double(get(hObject,'String')) returns contents of edit7 as a double
% --- Executes during object creation, after setting all properties.
function edit7_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit7 (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 edit8_Callback(hObject, eventdata, handles)
% hObject handle to edit8 (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 edit8 as text
% str2double(get(hObject,'String')) returns contents of edit8 as a double
% --- Executes during object creation, after setting all properties.
function edit8_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit8 (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
  4 Comments
sweatlana martins
sweatlana martins on 23 Jun 2022
@Jan Sir the command we are using in our code is varargout
@Jan Sir we are currently doing a project on fingerprint tampering detection.We have built up a code for the same using MATLAB . We are thinking of intergarting this code onto DSP TMS320C series which takes in C/C++ Code .During the conversion of this code into C using MATLAB2018b coder we are getting errors as attached below
Sir is there any other method by which we can integrate this MATLAB Code directly onto DSP TMS320 series for the hardware implementation of this project.
note: the code provided is of the main file which calls the other files

Sign in to comment.

Answers (1)

Rik
Rik on 22 Jun 2022
Unfortunately you can't convert a GUI to C with coder. There are just too many elements that aren't supported.
You can package the code to an executable, which will require the use of the Matlab Runtime Compiler on the client computer.
  2 Comments
sweatlana martins
sweatlana martins on 23 Jun 2022
@Rik Sir we are currently doing a project on fingerprint tampering detection.We have built up a code for the same using MATLAB . We are thinking of intergarting this code onto DSP TMS320C series which takes in C/C++ Code .During the conversion of this code into C using MATLAB coder we are getting errors as attached below
Sir is there any other method by which we can integrate this MATLAB Code directly onto DSP TMS320 series for the hardware implementation of this project.
note: the code provided is of the main file which calls the other files
Rik
Rik on 23 Jun 2022
It might be possible to convert the internal functions to C (depending on what functions are used exactly), but there is not a generally available way to convert a GUI (especially not one created with GUIDE) to C/C++.
I don't know anything about the specific hardware you mention. You should look up documentation for that device.

Sign in to comment.

Products


Release

R2014a

Community Treasure Hunt

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

Start Hunting!