MATLAB: Undefined operator ‘/’ for input arguments of type ‘matlab.ui​.control.U​IControl’.

undefined operator '/' for input arguments of type 'matlab.ui.control.uicontrol'.

Hello, Please i have this error whene i run my interface matlab:
Undefined operator '/' for input arguments of type 'matlab.ui.control.UIControl'.
Error in UAQP_power_control_method (line 63)
SINR2=target_SINR/currentSINR;
The code of my function is:
function [Pmacro Pfemto] = UAQP_power_control_method(handles)
Pmacro_dbm=handles.edit1;
%Pmacro_dbm = str2num(get(handles.edit1,'String'));
%Pmacro = (10^(Pmacro_dbm / 10)) / 1000;
Pfemto_max_dbm=handles.edit2;
%Pfemto_max_dbm = str2num(get(handles.edit2,'String'));
%Pfemto_max = (10^(Pfemto_max_dbm / 10)) / 1000;
%Pfemto_def_dbm = str2num(get(handles.edit4,'String'));
Pfemto_def_dbm=handles.edit4;
%Pfemto_def = (10^(Pfemto_def_dbm / 10)) / 1000;
target_SINR =handles.edit5;
%target_SINR = str2double(get(handles.edit5,'String'));
% N21=handles.edit15;
% N31=handles.edit35;
% N1=handles.edit47;
% N2=handles.edit18;
% N3=handles.edit19;
N21 = str2double(get(handles.edit15,'String'));
N31 = str2double(get(handles.edit35,'String'));
N1=str2num(get(handles.edit47,'String'));
N2=str2num(get(handles.edit18,'String'));
N3=str2num(get(handles.edit19,'String'));
coordVectors = get(handles.figure1, 'UserData');
numOfFemtocells = str2num(get(handles.edit20,'String'));
%numOfFemtocells = handles.edit20;
numOfFemtousers = handles.edit11;
numOfMacrocells = 1;
%N1=2;
% numOfFemtousers = str2num(get(handles.edit11,'String'));
P_min=-10;
SINR_th=10;
% N1=round(rand*8);
% N2=round(rand*8);
% N3=round(rand*8);
P0=0.0;
o2=0.4;
o1=0.9;
o3=0.1;
Q21=0.7;
Q31=0.3;
Q22=0.6;
Q32=0.2;
D=0.7;
Pfemto = zeros(1,numOfFemtocells);
% a=o2*Q21;
% b=o2*Q22;
% c=o2*Q31;
% d=o2*Q32;
a = o2*Q21*ones(N2,1);
b = o2*Q22*ones(N2,1 );
c = o2*Q31*ones(N3,1 );
d = o2*Q32*ones(N3,1);
SINR1=0;
SINR2=0;
SINR3=0;
%for i=1:numOfFemtocells
for i=1:N1
currentSINR = findRangeSINR(handles);
SINR1=currentSINR;
end
for i=1:N2
currentSINR = findRangeSINR(handles);
SINR2=target_SINR/currentSINR;
end
for i=1:N3
currentSINR = findRangeSINR(handles);
SINR3=target_SINR/currentSINR;
end
SINRp1=SINR1;
SINRp2=SINR2;
SINRp3=SINR3;
for i=1:numOfFemtocells
if (SINRp1(i+1)> SINR(i) && SINRp2(i+1)> SINR(i)&& SINRp3(i+1)> SINR(i))
Pfemto(i)=P0+(N1*o1)+sum(a(1:N2))+(sum(c(1:N3))*D);
else if (SINRp1(i)> SINR(i) && SINRp2(i+1)> SINR(i))
Pfemto(i)=P0+(N1*o1)+sum(a(1:N2))*D;
else if(SINRp1(i+1)> SINR(i))
Pfemto(i)=P0+(N1*o1)+sum(a(1:N21))*D;
else
Pfemto(i)=Pfemto(i-1);
end
end
end
end
end

Best Answer

You have
target_SINR =handles.edit5;
so target_SINR is a handle, not the content stored at the handle.
You have
SINR2=target_SINR/currentSINR;
so you are trying to divide the handle by something.
We cannot tell what the something is:
currentSINR = findRangeSINR(handles);
does not tell us what findRangeSINR does, and the code for that function was not included.
If you want the number the user has entered in the edit5 handle then you need
target_SINR = str2double(handles.edit5.String);
Caution: this will not update as the user enters new values: it will only update when the line is re-executed.
Note that you have three loops with the general form
for i=1:N1
currentSINR = findRangeSINR(handles);
SINR1=currentSINR;
end
Unless findRangeSINR is keeping a counter or choosing information randomly, then the output of that loop is not affected by how many times you run the loop body, since you do not use i anywhere in the loop, and you completely overwrite all of SINR1 each iteration of the loop. It is not obvious why you do not just do the assignments once without a for loop.
Related Question