필터 지우기
필터 지우기

How to convert a sign integer matrix to binary?

조회 수: 1 (최근 30일)
Maria Jacob
Maria Jacob 2020년 2월 26일
댓글: Maria Jacob 2020년 2월 26일
Hi, I have a quality flag that I want to convert to binary to create a binary mask. The QF is 7200x3600 int16.
I saw that some people were using: dec2bin(typecast(int16(QF),'unit16'))
but I get an error, because for using typecast the data has to be a vector.
I could reshape the data, convert it and then reshape it back to its original size, but I was wondering if there is a way to do it in just one step.
Thanks

채택된 답변

James Tursa
James Tursa 2020년 2월 26일
Reshaping is fast since it uses a shared data copy instead of a deep data copy. So your three step process isn't going to be slowed down much by it.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by