Azzera filtri
Azzera filtri

Why is it not possible to display a signal from a xpc-model on the gui using the function getsignal(handles.tg, signalnr)?

2 visualizzazioni (ultimi 30 giorni)
By running my gui-programming I get every time i click on the start-button a fault message looking like this:
??? Attempt to reference field of non-structure array.
Error in ==> xpc_diagnose_GUI1>startbutton_Callback at 86 fehlerart=getsignal(handles.tg, 18);
Error in ==> gui_mainfcn at 96 feval(varargin{:});
Error in ==> xpc_diagnose_GUI1 at 42 gui_mainfcn(gui_State, varargin{:});
Error in ==> @(hObject,eventdata)xpc_diagnose_GUI1('startbutton_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
Now my question is: Is there something missing regarding the tg or else that leads to this problem?

Risposte (2)

Ryan G
Ryan G il 27 Set 2012
Put a breakpoint at the GETSIGNAL line in the GUI and see what options are available when you do:
get(handles.tg)
I believe you should be able to see that the tg is connected and running by doing this and that your handle is correct.
There are a lot of possible issues here. Are you sure you have defined that signal (does signalnr exist)? Is the handle pointing to the target (step above is to diagnose that)? Is this a problem with your GUI and not xPC?
Another thing you should do is try running this code via the command window with xPC running to make sure your syntax is correct before implementing via gui if possible.

Domenico Leonardo
Domenico Leonardo il 28 Set 2012
Modificato: Domenico Leonardo il 28 Set 2012
Thank you for your answer.
I have a detailled description of the problem. The code getsignal(handles.tg, 18) does not work in the matlab command line.So it is anyway wrong.
When I write in the matlab command line getsignal(tg, 18) then I get the value of the desired signal. So I was expecting that by tiping in the GUI-code for example:
desiredvalue=getsignal(tg, 18); set(handles.textbox1, 'String', desiredvalue);
the GUI would display the desired value in the textbox1. But it doesn't work. Fault message: ??? Undefined function or variable 'tg'.
So something is missing in the code to make the object "tg" visible. But i realy don't know how to bind this object into the code.
  1 Commento
Ryan G
Ryan G il 28 Set 2012
A couple things. How do you create TG? Once you create it, i assume it's a different call back using it. How do you assign TG to the handles structure? Does handles.tg exist in the new callback?

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by