Maintain data type during variable assignment
Show older comments
Hello,
Let's say I have the following code:
a = uint32(1);
a = 2; % Changes the type back to double
What is the sytanx for preserving the existing uint32 data type IF I didn't want to keep doing uint32() casts on all new data. I remember in the past there was something like:
a := 2;
% or
a ?= 2;
% BUT THESE ARE BOTH WRONG
But I can't for the life of me find the right assignment operator that did this.
Anyone know how to do this?
Accepted Answer
More Answers (0)
Categories
Find more on Logical 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!