How can I use bit operation functions like bitconcat with both fi and built-in integer types without branching on isfi?
이전 댓글 표시
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
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Functions for Programming and Data Types에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!