Could I Change data type of state active status?

조회 수: 4 (최근 30일)
MINCHUL
MINCHUL 2023년 12월 22일
댓글: Angelo Yeo 2023년 12월 26일
As you know, the Default Value of State active status is a uint8
( I found Such a Infomation from Google Information Searching so, I`m not Sure that It is right or not)
But I`d like to change this data type into uint16
If you know options or any other ways that I can apply Pls let me know
  댓글 수: 3
MINCHUL
MINCHUL 2023년 12월 22일
I found that Infomation from Google Information Searching. so, I`m not Sure that It is right or not
Anyway, What you Recommend is that if I want to search more, should I refer that page right?
Angelo Yeo
Angelo Yeo 2023년 12월 26일
No. I was wondering if I need to find another source to figure out the "active status" data type is set to uint8 as default.

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

답변 (2개)

Dinesh
Dinesh 2023년 12월 22일
Hi Minchul.
In MATLAB, even if you don't have the option to change the default type for a variable, you can type cast it to give it the type that you want it to take.
For example, if you want to type cast it to "uint16", you can do the following:
variable_uint16 = uint16(variable_uint8);
  댓글 수: 1
MINCHUL
MINCHUL 2023년 12월 22일
Thanks, But what I want is Agility of Processing Program,
so It would be better for me defining that constant like ( #define uint 16 Variable ) directly when I use embedded Code > Generate Code

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


Angelo Yeo
Angelo Yeo 2023년 12월 26일
To me, the easiest is to use Data Conversion block to change a boolean to uint16. See the attached model for details.

카테고리

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

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by