Mapping Test Harness Inputs to an Excel .xlsx File

8 vues (au cours des 30 derniers jours)
Trevor Fry
Trevor Fry le 19 Juin 2017
The mathworks documentation( Importing Microsoft® Excel® Data ) shows how to map a .xlsx file to input ports in a test harness. This works fine if the input ports are doubles. However, if the input ports are boolean, the signal fails to map with the error: "Not compatible for simulation." I have tried using 0, 1 and TRUE, FALSE in the excel spreadsheet, but it still will not map. Is there a format for importing boolean data, or is this not supported?
  1 commentaire
Swarooph
Swarooph le 23 Juin 2017

From the looks of it, it seems that boolean may not be supported. In fact I tried with the linked example and nothing but double works. So I think you are better of creating a harness model ( Analysis > Harness > Create From Model) from your main model and add data conversion blocks . So the harness model will have double input port --> Data Conversion from double to boolean --> Main model boolean input port. Shown in the picture below:

Then using the harness you can map it now. Screenshot below:

Connectez-vous pour commenter.

Réponse acceptée

Young Ma
Young Ma le 2 Août 2017
Hi Trevor,
I understand from your description that you tried to map excel input data into boolean input port. The only data type supported in R2017a is double. Boolean type will be supported in R2017b, which will be released in September this year. But you can download a Prerelease trial from the following link to try this new feature:
A workaround for this is what Swarooph suggested in the comment section. You can try 'Data Type Conversion' block to suite your need.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by