reference to nonexistent field

10 visualizzazioni (ultimi 30 giorni)
Hamza
Hamza il 6 Mar 2016
Commentato: Hamza il 7 Mar 2016
Hi there I am trying to link two guis together , I have successfully transfered data between them using setappdata and getappdata But I've got error when trying set data into table (Reference to nonexistent field)
if true
function results_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 results (see VARARGIN)
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
a= getappdata(0,'a');
b=getappdata(0,'b');
d=zeros(size(a,1),size(b,2));
set(handles.uitable1,'Data',d)
choice=getappdata(0,'choice');
switch choice
case 1
if size(a)==size(b)
r=a+b;
set(handles.uitable1,'Data',r)
else
set(handles.text1,'string','lenghts must agree')
end
case 2
if size(a)==size(b)
r=a-b;
set(handles.uitable1,'Data',r)
else
set(handles.text1,'string','lenghts must agree')
end
case 3
if size(a,2)==size(b,1)
r=a*b;
set(handles.uitable1,'Data',r)
else
set(handles.text1,'string','inner dimensions must agree')
end
case 4
set(handles.uitable1,'Data',inv(a))
case 5
end
end
  12 Commenti
Image Analyst
Image Analyst il 7 Mar 2016
And, by the way, you missspelled lengths as lenghts.
Hamza
Hamza il 7 Mar 2016
you are right i have uitable2 in my gui not uitable1 thank you very much it works fine

Accedi per commentare.

Risposta accettata

Geoff Hayes
Geoff Hayes il 7 Mar 2016
Hamza - if you look at your results.fig from within GUIDE, you will note that there is one uitable and one static text control. If you double-click on the uitable and look at its Tag property you will see that it is named uitable2 and not uitable1. Change the name, save the figure/GUI, and try again.
  1 Commento
Hamza
Hamza il 7 Mar 2016
thank you the tag was uitable2 not uitable1 now it works fine

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Programming in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by