필터 지우기
필터 지우기

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

조회 수: 214 (최근 30일)
Afiq Anang
Afiq Anang 2023년 8월 18일
답변: Ishu 2023년 8월 28일
% --- 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);

답변 (1개)

Ishu
Ishu 2023년 8월 28일
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!

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by