Turning a char element in a double array

1 回表示 (過去 30 日間)
Teoman Selcuk
Teoman Selcuk 2021 年 10 月 18 日
回答済み: the cyclist 2021 年 10 月 18 日
How can I turn a char element into an array of double values. I am trying to get the Expected Output below but array_convert does not work. How would I be able to get the Expected Output below?
Code:
a = char('[21,12,43,1]')
array_convert= str2double(a)
Expected Output:
[21 12 43 1]

回答 (1 件)

the cyclist
the cyclist 2021 年 10 月 18 日
a = char('[21,12,43,1]');
array_convert = str2num(a)
array_convert = 1×4
21 12 43 1

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by