How can I make a string?
조회 수: 1 (최근 30일)
이전 댓글 표시
I have some values as : A=
0
0
1
0
1
0
1
0
0
1
1
0
I want to take every 4 values in a string.
Output should be : B =
0 0 1 0
1 0 1 0
0 1 1 0
And, after that I want to covert the values from binary to decimal.
Final output should be :
2
10
6
It cuould be better for me if it is done in a loop. Because, I have a length of "A" near 40+ lacs.
댓글 수: 0
채택된 답변
KALYAN ACHARJYA
2021년 1월 4일
편집: KALYAN ACHARJYA
2021년 1월 4일
B=reshape(A,[4,3])';
C=num2str(B);
bin2dec(C)
Output :
ans =
2
10
6
Note: Loop is not necessity .
댓글 수: 4
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!