Can we call a class in test sequence

1 vue (au cours des 30 derniers jours)
Hariom Singh
Hariom Singh le 19 Oct 2018
Test sequence can use function declared in any mscript for example The below line works perfectly
*step_1
Stick1_Raw_Data.Stick_Main_Sensor_TRX1_Raw_Data = update_or_initialize_Stick_Raw_Data();*
function Stick_Raw_Data_Stick_Main_Sensor_TRX1_Raw_Data = update_or_initialize_Stick_Raw_Data(x,x_error,y,y_error)
% Sets the inital value or update the value
if nargin < 4
Stick_Raw_Data_Stick_Main_Sensor_TRX1_Raw_Data = struct();
Stick_Raw_Data_Stick_Main_Sensor_TRX1_Raw_Data.X = int16(0);
Stick_Raw_Data_Stick_Main_Sensor_TRX1_Raw_Data.X_Error = uint8(0);
Stick_Raw_Data_Stick_Main_Sensor_TRX1_Raw_Data.Y = int16(0);
Stick_Raw_Data_Stick_Main_Sensor_TRX1_Raw_Data.Y_Error = uint8(0);
else
Stick_Raw_Data_Stick_Main_Sensor_TRX1_Raw_Data = struct();
Stick_Raw_Data_Stick_Main_Sensor_TRX1_Raw_Data.X = int16(x);
Stick_Raw_Data_Stick_Main_Sensor_TRX1_Raw_Data.X_Error = uint8(x_error);
Stick_Raw_Data_Stick_Main_Sensor_TRX1_Raw_Data.Y = int16(y);
Stick_Raw_Data_Stick_Main_Sensor_TRX1_Raw_Data.Y_Error = uint8(y_error);
end
end
But can we also use it to declare and use a object
step_3
m = Stick_Raw_Data_Stick_Main_Sensor_TRX_Raw_Data;
%Stick1_Raw_Data.Stick_Main_Sensor_TRX1_Raw_Data = m.update(int16(23),uint8(0),int16(1500),uint8(0));
classdef Stick_Raw_Data_Stick_Main_Sensor_TRX_Raw_Data
properties
X
X_Error
Y
Y_Error
end
methods
function r = initialize(obj)
r.X = int16(0);
r.X_Error = uint8(0);
r.Y = int16(0);
r.Y_Error = uint8(0);
end
function r = update(obj,x,x_error,y,y_error)
r.X = int16(x);
r.X_Error = uint8(x_error);
r.Y = int16(y);
r.Y_Error = uint8(y_error);
end
end
end
Getting error Chart 'Test Sequence' has unresolved symbols.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by