Cannot convert double value 108041 to a handle

조회 수: 2 (최근 30일)
youssef Mostafa
youssef Mostafa 2022년 4월 19일
답변: Walter Roberson 2022년 4월 19일
function CalculateButtonPushed(app)
if strcmp(app.Type_of_analysis.Value,'Exact') && app.Primary.Value == 1
R2_= app.R2.Value*(app.Turns_ratio.Value)^2;
X2_double=str2double (app.X2.Value);
X1_double=str2double(app.X1.Value);
Xm_double=str2double(app.Xm.Value);
X2_=X2_double*(app.Turns_ratio.Value)^2;
V2_=app.Load_voltage.Value*(app.Turns_ratio.Value)^2;
angle_power= -acosd(app.Power_factor.Value);
Power1= app.Input_Power.Value*app.Percentage_of_loading.Value*0.01;
I_load_magnitude=Power1/V2_;
I_load_= I_load_magnitude*cos(angle_power*pi/180)+I_load_magnitude*sin(angle_power*pi/180)*1i;
V_x= V2_+I_load_*(R2_+X2_double);
I_m= V_x/Xm_double;
I_c= V_x/app.Rc.Value;
I_phi= I_m+I_c;
I_input= I_phi+I_load_;
I_input_angle= angle(I_input);
I_input_magnitude= abs(I_input);
Input_voltage= V_x + I_input*(app.R1.Value+X1_double);
app.Input_voltage_magnitude.Value= abs(Input_voltage); *****error: While setting the 'Input_voltage_magnitude' property of 'Transformer_project': Cannot convert double value 108041 to a handle ******
app.Input_voltage_angle.Value= angle(Input_voltage);
Power_factor1= cos(angle(Input_voltage)-I_input_angle);
app.Input_Power.Value=app.Input_voltage_magnitude*I_input_magnitude*Power_factor1;
app.Voltage_regulation.Value=(app.Input_voltage_magnitude-V2_)/V2_*100;
end

답변 (1개)

Walter Roberson
Walter Roberson 2022년 4월 19일
app.Input_voltage_magnitude.Value= abs(Input_voltage);
That code assumes that app.Input_voltage_magnitude is a control of some kind, perhaps a text field
app.Input_Power.Value=app.Input_voltage_magnitude*I_input_magnitude*Power_factor1;
but you cannot multiply a control by anything.
This tells us that you are confused about whether it is a numeric value or a control.

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by