Clear Filters
Clear Filters

How to rectify the below error?

1 view (last 30 days)
savita sheelavant
savita sheelavant on 7 Jun 2021
Answered: arushi on 29 Apr 2024
Error using ui_mex_link
configuration error
Error in gray_mex
Error in extract_layers (line 61)
gray_mex
Error in Layer_Extraction_App>pushbutton4_Callback (line 133)
extract_layers(img,handles);
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in Layer_Extraction_App (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)Layer_Extraction_App('pushbutton4_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.
The code1 of matlab
function varargout = Layer_Extraction_App(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Layer_Extraction_App_OpeningFcn, ...
'gui_OutputFcn', @Layer_Extraction_App_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 Layer_Extraction_App is made visible.
function Layer_Extraction_App_OpeningFcn(hObject, eventdata, handles, varargin)
handles.sel=1;
set(handles.text4, 'String', ' ');
set(handles.text5, 'String', ' ');
set(handles.text6, 'String', ' ');
set(handles.text7, 'String', ' ');
set(handles.text8, 'String', ' ');
set(handles.text9, 'String', ' ');
% Choose default command line output for Layer_Extraction_App
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes Layer_Extraction_App wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = Layer_Extraction_App_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)
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
function pushbutton3_Callback(hObject, eventdata, handles)
% --- 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)
[f,p]=uigetfile('layer_img/*.*', 'Specify an image file');
img=imread([p,f]);
yrange = [];
xrange = [];
% make image type as double.
% img =imread('DME-1081406-1.jpeg');
img = double(img);
% figure,
axes(handles.axes1);
imshow(img)
% get size of image.
szImg = size(img);
if isempty(yrange) && isempty(xrange)
yrange = 1:szImg(1);
xrange = 1:szImg(2);
end
img = img(yrange,xrange);
extract_layers(img,handles);
% --- 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 Layer_Extraction_App
Main_App
% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close Layer_Extraction_App
Classifier_App
% --- Executes on button press in radiobutton1.
function radiobutton1_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton1
handles.sel=get(hObject,'Value');
if(handles.sel==1)
set(handles.text3, 'String', 'marking');
else
set(handles.text3, 'String', 'contionus ');
end
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
Code 2: suporting file where code1 is used
function varargout = Main_App(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Main_App_OpeningFcn, ...
'gui_OutputFcn', @Main_App_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 Main_App is made visible.
function Main_App_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 Main_App (see VARARGIN)
% ah=axes('unit','normalized','position',[0 0 1 1]);
% bg=imread('App_Cover.png'); imagesc(bg);
% set(ah,'handlevisibility','off','visible','off');
% uistack(ah,'bottom');
% Choose default command line output for Main_App
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes Main_App wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = Main_App_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)
close Main_App
Classifier_App
% --- 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)
close Main_App
Layer_Extraction_App

Answers (1)

arushi
arushi on 29 Apr 2024
Hi Savita,
The error message you're encountering might be related with a Mex file (`gray_mex`) used in your `extract_layers` function.The error "Error using ui_mex_link configuration error` indicates a problem with linking or running this compiled code. Here are several steps to troubleshoot and potentially resolve this issue:
1. Verify Mex File Compatibility
Ensure the Mex file is compatible with your current MATLAB version and operating system. Mex files compiled for a different version of MATLAB or a different operating system might not run correctly.
2. Recompile the Mex File
If you have access to the original source code for `gray_mex`, try recompiling it on your system. This ensures compatibility with your MATLAB environment.
3. Check for Missing Dependencies
Mex files might depend on external libraries or runtime environments. Ensure all required dependencies are installed and correctly configured on your system. Missing or misconfigured dependencies can lead to runtime errors.
4. MATLAB Path
Ensure that the directory containing `gray_mex` is on the MATLAB path. Use the `addpath` function to add the directory if necessary.
Hope this helps.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!