Error using bitset fuction
조회 수: 2 (최근 30일)
이전 댓글 표시
i have value A=46;
i used bitset function to change the second bit ,i get abswer ,but how to change the last 2 bits ,i tried using
X=bitset(A,1:2,1); setting last two bits to one
please help
댓글 수: 0
채택된 답변
Walter Roberson
2012년 11월 22일
bitset() is not defined to be able to change two bits at a time.
bitset(bitset(A, 1, 1), 2, 1)
댓글 수: 2
Walter Roberson
2012년 11월 22일
A is only of length 1, so end-2 would be trying to access column -1.
Indexing of numeric data does not access bits.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import and Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!