From: Oscar on
I am trying to compile a GUI and it goes well, but when I try to run the compiled version I get the following message:

An error occurred in the callback : Calculadora('PB_1_Callback',gcbo,[],guidata(gcbo))
The error message caught was : Reference to unknown function or variable 'Calculadora' while evaluating expression.

(I working with MatLab Vr. 6, Compiler Vr. 3 and Borland Vr. 5.6)

I did a small GUI (works good on matlab) and I got the same problem (it does not recognize the Calculadora function), the small .m file is

function varargout = Calculadora(varargin)

gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Calculadora_OpeningFcn, ...
'gui_OutputFcn', @Calculadora_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin & isstr(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 Calculadora_OpeningFcn(hObject, eventdata, handles, varargin)

handles.output = hObject;

guidata(hObject, handles);

function varargout = Calculadora_OutputFcn(hObject, eventdata, handles)

varargout{1} = handles.output;

function PB_1_Callback(hObject, eventdata, handles)
if get(handles.LIS,'value')==1
a=str2double(get(handles.ED_1,'string'));
b=str2double(get(handles.ED_2,'string'));
c=a+b;
set(handles.TX_1,'String',c);
else
a=str2double(get(handles.ED_1,'string'));
b=str2double(get(handles.ED_2,'string'));
c=a-b;
set(handles.TX_1,'String',c);
end


Thanks in advance
From: ImageAnalyst on
Strange error message because I can't see any mention of Calculadora
in 'PB_1_Callback' at all.
I'm assuming it runs from within MATLAB, correct?

Try running "Tools --> Show Dependency Report" on it. Pay special
attention to anything it lists as "other." I'm guessing there's a lot
more to this file than you listed (for example you mentioned
handles.ED but nowhere do I see any code to create such a control, so
at least that code is missing).
From: Oscar on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <c9a99fe7-f2ac-41f7-82d4-3ffe9f92f46c(a)r9g2000vbk.googlegroups.com>...
> Strange error message because I can't see any mention of Calculadora
> in 'PB_1_Callback' at all.
> I'm assuming it runs from within MATLAB, correct?
>
> Try running "Tools --> Show Dependency Report" on it. Pay special
> attention to anything it lists as "other." I'm guessing there's a lot
> more to this file than you listed (for example you mentioned
> handles.ED but nowhere do I see any code to create such a control, so
> at least that code is missing).

Thanks for your answer. Calculadora.m is the m file created by guide and I put some instructions in the PushBoton. I am working in a huge GUI but trying to catch the error I just made a small one (the one I pasted) that adds a couple of numbers placed in edit text boxes. The callback property inspector box calls the callbak function as:

Calculadora('PB_1_Callback',gcbo,[],guidata(gcbo))

It is this "Calculadora" name/function that is not recognized once compiled.

Thanks
From: Oscar on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <c9a99fe7-f2ac-41f7-82d4-3ffe9f92f46c(a)r9g2000vbk.googlegroups.com>...
> Strange error message because I can't see any mention of Calculadora
> in 'PB_1_Callback' at all.
> I'm assuming it runs from within MATLAB, correct?
>
> Try running "Tools --> Show Dependency Report" on it. Pay special
> attention to anything it lists as "other." I'm guessing there's a lot
> more to this file than you listed (for example you mentioned
> handles.ED but nowhere do I see any code to create such a control, so
> at least that code is missing).

I forgot to confirm that it runs OK within MATLAB. In fact it runs OK using the compiled MEX file but still within MATLAB, the problem apears only when I try to use it in a stand alone form.(It compile OK but the controls does not work)

Thanks again
From: ImageAnalyst on
Oscar:
OK, I understand. When you look at the "Callback" property in the
"Property Inspector" panel in GUIDE, it says
Calculadora('PB_1_Callback',gcbo,[],guidata(gcbo))

I would guess that some names don't match up. Like your m-file is not
named Calculadora.m, or it doesn't match the function declaration in
the file or your fig file has a different name than the m-file or
something like that. Remember - it's case sensitive.

First, install the MCR on your development computer (don't worry - it
won't screw anything up with your full MATLAB). Then run your app
from the command window using the ! operator. Then comeback here and
paste exactly what it says (since what you posted doesn't EXACTLY look
like the kind of error message MATLAB generates so I know you
"paraphrased" it at least a little bit.)

In the command window, type
which -all Calculadora
and also type
which -all calculadora
(because, remember, it's case sensitive)
Tell me what it says for both cases, even if it's just "calculadora
not found."

Lastly, you can send the Mathworks your project and they will figure
it out for you (assuming you have a current maintenance contract).
-ImageAnalyst