How do I read in data from a spreadsheet to a Test Vector for a SystemTest of a Simulink Model, as datatype single?

1 visualización (últimos 30 días)
I have the following error message, listing the source as "Simulink", in the Run Status box of SystemTest:
"Invalid data type for root level inport 'LimitSignal/Signal'. The model is configured to load its root level inports from the workspace. These external inputs must have data type 'double'. This data type does not agree with the data type, 'single', that is being set for this root level inport. Loading external inputs from the workspace is turned off by going to the Simulation menu and selecting Configuration Parameters. On the Data Import/Export page, locate the Load from workspace group and uncheck the Input checkbox."
The recommendation it gives does not work, as that checkbox is already unchecked.
Changing the Simulink model inputs to receive 'double' instead of 'single' prevents this error message, but can't I read in from the spreadsheet as 'single'?

Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 22 de Ag. de 2011
You are using the SystemTest toolbox. It has some type of automation that can import data from Excel sheet behind the scene. I don't know how to resolve that problem. Maybe you can contact TMW tech support for help.
Without the toolbox, normally you would import the data into workspace and then use it in Simulink. It's easy to do the convertion in MATLAB.
Data=xlsread(ExcelFile);
Data=single(Data);
There got be some script that does the import so if you can find it, you can add the single() conversion. Again, calling TWM might be the easiest way to find it out.
  5 comentarios
Fangjun Jiang
Fangjun Jiang el 22 de Ag. de 2011
Good! One more thing to recommend is to do xlsread() once because running it multiple times is in-efficient. Once the data is read in, you can use MATLAB operation to split data into the variable names you want.
data=xlsread('test.xls');
time=single(data(1:21,1));
signal=single(data(1:21,2));
...
James
James el 23 de Ag. de 2011
Many thanks!
Another solution:
I have discovered the Design Verifier generates a test harness model that wraps the component under test, and the data conversion is automatically inserted there (admittedly due to it using Signal Builder to provide the inputs).
The same technique could be done for this.

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by