![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1574632/image.png)
Could I Change data type of state active status?
1 view (last 30 days)
Show older comments
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 Comments
Angelo Yeo
on 26 Dec 2023
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.
Answers (2)
Dinesh
on 22 Dec 2023
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);
Angelo Yeo
on 26 Dec 2023
To me, the easiest is to use Data Conversion block to change a boolean to uint16. See the attached model for details.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1576207/image.png)
0 Comments
See Also
Categories
Find more on Complex Logic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!