Manipulating data in Cell Arrays

1 次查看(过去 30 天)
Hi All
I have a simple question as follows:
I have a cell matrix of size (20 X 20). All cells are filled with data like 'S1', 'S2', 'S3' to 'S400'. There is no other data. I want to remove 'S' from all cells and only keep the numeric part in the matrix.
Your help will be highly appreciated.
Regards
AMD.

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2015-8-31
编辑:Azzi Abdelmalek 2015-8-31
If data is your matrix
out=str2double(cellfun(@(x) regexp(x,'\d+','match'),data))

更多回答(1 个)

Jan
Jan 2015-10-27
编辑:Jan 2015-10-27
str2double(strrep(data, 'S', ''))

类别

Help CenterFile Exchange 中查找有关 Cell Arrays 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by