필터 지우기
필터 지우기

Double to Logical convertion in Simulink

조회 수: 30 (최근 30일)
Alexander Babin
Alexander Babin 2021년 1월 25일
댓글: Alexander Babin 2021년 1월 25일
Dear friends!
So i have an array of boolean like this:
[0 1 0 1 1 1 1 0 0 1 0]
If you plot it in Matlab, you get something like this:
And the values are exactly 0 and 1.
Now I put this array into a .mat file and send it to a Simulink model, where there is a function that actually takes boolean values, so i use conversion like this:
Now, if you plot the input array of 1 and 0 alongside the converted values, you will get this:
Notice, that most of the values are converted correctly, while at the end of the array, some values of the 'actual' array, are not quite zero, but 1.11e-15. Since they are not zero, I believe, they get converted into a '1' in boolean terms. The lower figure shows a zoomed in part of one of the points.
So, my question is why, oh, why is it like this?

채택된 답변

Fangjun Jiang
Fangjun Jiang 2021년 1월 25일
  1. Change the settings of the "From File" block. Do not do interpolation or extrapolation.
  2. The boolean data type could be saved with the .mat file, so you don't need the data type conversion block.
  댓글 수: 1
Alexander Babin
Alexander Babin 2021년 1월 25일
great, thanks!
about boolean type in .mat files - thanks again, knew that, was gonna do that :)

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by