Mapping Test Harness Inputs to an Excel .xlsx File

조회 수: 8 (최근 30일)
Trevor Fry
Trevor Fry 2017년 6월 19일
답변: Young Ma 2017년 8월 2일
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
Swarooph
Swarooph 2017년 6월 23일

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:

댓글을 달려면 로그인하십시오.

채택된 답변

Young Ma
Young Ma 2017년 8월 2일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Inputs에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by