Error in parameter passing between two .m files (Error using feval and Error while evaluating uicontrol callback)

Hello,
I am working on developing a GUI for a Digital down converter (DDC). DDC works well and I am creating a GUI which feeds inputs to the DDC and displays the frequency spectrum. In the GUI.fig there are two edit text boxes where I enter the frequency values and there is a run button which passes the parameters from GUI.m file to DDC_FILTER.m file. This works well when I run in matlab. Once I create this to executable and run the exe, it throws a error. After working on this I figured out this error might be due to passing parameters from GUI.m to DDC_FILTER.m. The errors are below
1) Error using feval
2) Error while evaluating uicontrol callback
3)Error in GUI_mainfcn
4)Error in pushbutton9_Callback
The code looks like this
IN THE FIG.M FILE
function pushbutton9_Callback(hObject, eventdata, handles)
fsvalue = str2num(get(handles.fs,'String'));
fpassvalue = str2num(get(handles.fpass,'String'));
[Tsample,Ts,Tfft,filt_sel1,cfir,pfir,reset,cfir_coef,cfir_wt] = ddc_filter(fsvalue,fpassvalue);
IN THE DDC_FILTER.M FILE
function [Tsample,Ts,Tfft,filt_sel1,cfir,pfir,reset,cfir_coef,cfir_wt] = ddc_filter(fsvalue,fpassvalue)
Fs = fsvalue;
Fpass = fpassvalue;
Any help would be appreciated.
Thanks
Vijay

Answers (2)

In the function that opens the .fig file, add the line
%#function pushbutton9_Callback
GUIDE codes references to GUI callbacks inside of strings where the compiler cannot find them, so the compiler does not know to link the callback function in.

1 Comment

Vijay's "Answer" moved here as a comment:
Hello Walter,
Do I have to add this line here?
% --- Executes just before DDC is made visible.
function DDC_OpeningFc(hObject, eventdata, handles, varargin)
% Choose default command line output for DDC
handles.output = hObject;

Sign in to comment.

Hello Walter,
I inserted the line of code in the function that opens the .fig file. I assume this line of code is assumed to be a comment by the matlab script. The compiler is still not able to find the run button.
%#function pushbutton9_Callback
Any help will be appreciated.
Thanks
Vijay

Categories

Products

Asked:

on 13 Sep 2013

Community Treasure Hunt

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

Start Hunting!