Borrar filtros
Borrar filtros

Hi, help me in this error: unrecognized field name 'categories'.

214 visualizaciones (últimos 30 días)
Afiq Anang
Afiq Anang el 18 de Ag. de 2023
Respondida: Ishu el 28 de Ag. de 2023
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
categories=handles.categories;
congMat(1)=handles.congMat(1);
congMat(22)=handles.congMat(22);
congMat(43)=handles.congMat(43);
congMat(64)=handles.congMat(64);
congMat(85)=handles.congMat(85);
congMat(106)=handles.congMat(106);
congMat(127)=handles.congMat(127);
congMat(148)=handles.congMat(148);
congMat(169)=handles.congMat(169);
congMat(190)=handles.congMat(190);
congMat(211)=handles.congMat(211);
congMat(232)=handles.congMat(232);
congMat(253)=handles.congMat(253);
congMat(274)=handles.congMat(274);
congMat(295)=handles.congMat(295);
congMat(316)=handles.congMat(316);
congMat(337)=handles.congMat(337);
congMat(358)=handles.congMat(258);
congMat(379)=handles.congMat(379);
congMat(400)=handles.congMat(400);

Respuestas (1)

Ishu
Ishu el 28 de Ag. de 2023
Hi Afiq,
The error message “unrecognized field name ‘categories’” indicates that the field name ‘categories’ does not exist within the handles structure.
Before using ‘categories’ field you need to ensure that the field 'categories' is correctly defined and initialized within the ‘handles’ structure. To ensure this you can follow these steps:
  1. Check if the field ‘categories’ is defined in the initialization function. To check this, you can make use of ‘isfield’ function.
  2. As MATLAB is case sensitive, verify the spelling and case sensitivity of the field name.
  3. Ensure that the code that assigns value to the ‘categories’ field is executed before the line “categories = handles.categories” is reached.
For more information on ‘isfield function you can refer to this documentation:
Hope it helps!

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by