필터 지우기
필터 지우기

What is the meaning of "There is no property on the UIControl class."?

조회 수: 3 (최근 30일)
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD 2017년 11월 21일
댓글: Walter Roberson 2019년 12월 26일
Dear All, I have sets of data and I need to import them to the function based on the month variable, I wrote this code on the gui to code the popupmenu1 I have, but still doesnt work and gives errors, any ideas please ? I have two cases, one is January and the 2nd is July.
% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu1
directory=dir('*.Y07');
count=0;
for K = 1 : length(directory)
filename = directory(K).name;
fileID = fopen(filename,'r');
formatSpec = '%s';
A_cell = textscan(fileID,formatSpec);
A=char(A_cell{1,1}{:,:});
A(find(isnan(A)))=0;
[rows,columns]=size(A);
if columns~=105
ArrayTemp=zeros(rows,105);
ArrayTemp(1:rows,1:columns)=A;
A=ArrayTemp;
A=char(A);
A(isspace(A)) = '0';
end
x1=filename;
xtr=strcat('C:\Users\maa285\Desktop\New folder (2)\',x1);
fid = fopen( xtr, 'wt' );
Month_of_Data = A(:,14:15);
Vehicle_Class = A(:,20:21);
Ans_7=str2num(Month_of_Data);
Ans_10=str2num(Vehicle_Class);
VehClass = Ans_10;
Class9_data = all(VehClass == 9, :);
count=count+1;
state=get(handles.popupmenu1,'value');
month(K)=unique(str2num(Month_of_Data));
switch state
case 1
% month(K)=unique(str2num(Month_of_Data));
set(handles.push1,'Class9_data',Class9_data(Ans_7 == 1, :));
case 2
% month(K)=unique(str2num(Month_of_Data));
set(handles.push1,'Class9_data',Class9_data(Ans_7 == 7, :));
end
end
  댓글 수: 2
Walter Roberson
Walter Roberson 2017년 12월 22일
Please post an exact copy of the error message.
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD 2017년 12월 22일
Dear Mr Walter, I solved this question and it was my mistake by not defining the proper tags for the controllers. Thank you man

댓글을 달려면 로그인하십시오.

답변 (2개)

Inam khan
Inam khan 2019년 12월 25일
Hello
Somebody can help by solving this error
2019-12-25_190404.png

Inam khan
Inam khan 2019년 12월 25일
function PB2ON_Callback(hObject, eventdata, handles)
% hObject handle to PB2ON (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global x;
writeDigitalPin (x, 'D5', 1);
set(handles.PB2ON, 'variable', 'off');
set(handles.PB2OFF, 'variable', 'on');
% --- Executes on button press in PB2OFF.
function PB2OFF_Callback(hObject, eventdata, handles)
% hObject handle to PB2OFF (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global x;
writeDigitalPin (x, 'D5', 0);
set(handles.PB2ON, 'variable', 'on');
set(handles.PB2OFF, 'variable', 'off');
  댓글 수: 2
Walter Roberson
Walter Roberson 2019년 12월 26일
What is class(handles.PB2ON) and class(handles.PB2OFF) ?
I do not recall ever having encountered a Mathworks object class that had a property named variable
I wonder if you wanted to use 'visible' instead of 'variable', or if you wanted to use 'enable' instead of 'variable' ?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by