Need help in getting value in uitable and doing strcmp ==1

8 visualizaciones (últimos 30 días)
I am doing a uitable function in a GUI and one of the column consist of popupmenu. In the popupmenu, if the user selects A, the strcmp will reflect it as 1, otherwise it's 0.
This is my function code.
function uitable2_CellEditCallback(hObject, eventdata, handles)
uitable2 = get(handles.uitable2,'Data')
strcmp(uitable2(1,1),'A')
However, I am getting this error:
Not enough input arguments.
Error in work_file>uitable2_CellEditCallback (line 7067)
uitable2 = get(handles.uitable2,'Data')
Error while evaluating Table CellEditCallback
Anyone here able to advise? Thanking you in advance.

Respuesta aceptada

Walter Roberson
Walter Roberson el 17 de Abr. de 2019
Editada: Walter Roberson el 17 de Abr. de 2019
I suspect you coded the table CellEditCallback function yourself, and that when you did, that you did not use interface code to insert the handles into the call to uitable2_CellEditCallback . MATLAB only passes two arguments automatically and not handles; when GUIDE is responsible for creating a callback, then it uses extra logic to insert the handles structure into the call.
You can probably insert the line
handles = guidata(hObject);
just before the reference to handles.uitable2. On the other hand, chances are that you can instead convert your get into
uitable2 = get(hObject, 'Data');
  1 comentario
Bertrand Low
Bertrand Low el 18 de Abr. de 2019
Thank you! You are amazing! I changed to uitable2 = get(hObject, 'Data'); and it worked! :)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by