Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How can I fix this error?

조회 수: 1 (최근 30일)
Daniel Fonsêca
Daniel Fonsêca 2019년 1월 31일
마감: MATLAB Answer Bot 2021년 8월 20일
I made a GUI and I put this:
% --- Executes just before kkkkkkkk is made visible.
function kkkkkkkk_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 kkkkkkkk (see VARARGIN)
%Ao carregar o programa sem fecha-lo, aparece vários menus oi
% Choose default command line output for kkkkkkkk
handles.output = hObject;
ff = findobj(handles.output, 'tag', 'k')
j=0;
for x=1:3
j(x,1)= uimenu(ff, 'tag', strcat('t',num2str(x)), 'Label',num2str(x) ,'Callback',@jj_Callback);
end
% Update handles structure
guidata(hObject, handles);
Without to close that figure, I rerun it, so, when i do that, the menus reshow.
See: I run once, it shows 3 menus items. When I rerun, it shows 6 menus: 1,2,3,1,2,3; and that follow. So, if I rerun that program without close it 6 times, it shows 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3.

답변 (1개)

Walter Roberson
Walter Roberson 2019년 1월 31일
편집: Walter Roberson 2019년 1월 31일
You are not clearing out any existing children when you start the function.
You could force everything to be reset by deleting the figure when you are done with one run of it.

이 질문은 마감되었습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by