How to get double array from string

44 ビュー (過去 30 日間)
Ümit Güden
Ümit Güden 2019 年 10 月 25 日
コメント済み: Ümit Güden 2019 年 10 月 25 日
Hi everyone,
I have a edit box in which I want to enter an array like
1:5
or
[1,2,3,5]
or
[1,2,3:6,9,12:15]
. Since this is edit an edit box when I read the box I get string.
Is there an easy way of converting this string version of double array to a real double array.
For example when I enter the
'[1,2,3:6,9,12:15]'
to edit box I want to get the double array
A= [1,2,3:6,9,12:15]
which is equal to
[1 2 3 4 5 6 9 12 13 14 15]
Thanks in advance.

採用された回答

Stephan
Stephan 2019 年 10 月 25 日
編集済み: Stephan 2019 年 10 月 25 日
>> A = str2num('[1,2,3:6,9,12:15]')
A =
1 2 3 4 5 6 9 12 13 14 15
  1 件のコメント
Ümit Güden
Ümit Güden 2019 年 10 月 25 日
Thanks @Stephan.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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