How can I use bit operation functions like bitconcat with both fi and built-in integer types without branching on isfi?
Show older comments
I'm working with bit operation functions (e.g., bitconcat) that only accept fi objects as input. My code sometimes deals with built-in integer types (like uint8, int16, etc.), so I currently check with isfi(var) and branch accordingly to convert to fi only when needed.
Is there a cleaner or more efficient way to ensure compatibility with bitconcat and similar functions, without manual branching on input type?
If I write:
a = uint8(2)
bitconcat(a)
I got error like: Input arguments must be fi objects.
Current workaround
if isfi(var)
% Already fi
else
var = fi(var, ...);
end
Accepted Answer
More Answers (0)
Categories
Find more on Fixed Point 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!