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에서 Cell Arrays에 대해 자세히 알아보기

질문:

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