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
Guillaume
Guillaume 2019 年 7 月 13 日
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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by