Hi , i want to convert the string here in binary format so that i can manipulate the element of bits. I want to convert into binary for each element.
Here what i have:
kol =
10×1 string array
"1"
"0"
"1"
"1"
"1"
"1"
"0"
"1"
"1"
"1"

 채택된 답변

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 7월 13일
편집: KALYAN ACHARJYA 2019년 7월 13일

1 개 추천

kol='1';
data1=str2double(kol);
data2=logical(data1)
Command Window:
>> whos data2
Name Size Bytes Class Attributes
data2 1x1 1 logical

댓글 수: 4

madhan ravi
madhan ravi 2019년 7월 13일
str2num() is not recommended use str2double() instead
KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 7월 13일
Incorporated, Thank you @madhan ravi
Well, actually, since the input is a string array, just double will do it:
>> kol = ["0", "1", "1", "1", "1", "0", "1", "1", "1"];
>> double(kol)
ans =
0 1 1 1 1 0 1 1 1
zahrein yaacob
zahrein yaacob 2019년 7월 13일
Thanks , it works.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품

릴리스

R2018a

태그

질문:

2019년 7월 13일

댓글:

2019년 7월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by