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

5 次查看(过去 30 天)
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 个评论
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 中查找有关 Develop Apps Using App Designer 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by