Manipulating data in Cell Arrays

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 日

0 投票

If data is your matrix
out=str2double(cellfun(@(x) regexp(x,'\d+','match'),data))

1 件のコメント

ARS
ARS 2015 年 8 月 31 日
Thanks Azzi, works great.

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

その他の回答 (1 件)

Jan
Jan 2015 年 10 月 27 日
編集済み: Jan 2015 年 10 月 27 日

0 投票

str2double(strrep(data, 'S', ''))

カテゴリ

ヘルプ センター および File ExchangeCell Arrays についてさらに検索

製品

質問済み:

ARS
2015 年 8 月 31 日

編集済み:

Jan
2015 年 10 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by