I have a 12460x1 cell array with the content "<asdasd=!a1=-10.0" in each cell. I need the double values at the end and convert this to a matrix. Please note that there is always one more number in the cells and the values that I need could be positive or negative. Thanks in advace.

 採用された回答

Andrei Bobrov
Andrei Bobrov 2016 年 5 月 11 日
編集済み: Andrei Bobrov 2016 年 5 月 11 日

1 投票

% z - your cell array.
x = regexp(z,'[\+\-]?\d+\.\d+$','match');
x = [x{:}]';
out = str2double(x);

1 件のコメント

GO
GO 2016 年 5 月 11 日
Thank you. I have found similar answers on the web but couldn't manage to do it properly. This solves the problem.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Data Type Conversion についてさらに検索

質問済み:

GO
2016 年 5 月 11 日

コメント済み:

GO
2016 年 5 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by