What is the meaning of "There is no property on the UIControl class."?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (2)
Inam khan
le 25 Déc 2019
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 commentaires
Walter Roberson
le 26 Déc 2019
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' ?
Voir également
Catégories
En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!