How can I use bit operation functions like bitconcat with both fi and built-in integer types without branching on isfi?
Ältere Kommentare anzeigen
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
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Functions for Programming and Data Types finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!