Effacer les filtres
Effacer les filtres

Manipulating data in Cell Arrays

2 vues (au cours des 30 derniers jours)
ARS
ARS le 31 Août 2015
Modifié(e) : Jan le 27 Oct 2015
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.

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 31 Août 2015
Modifié(e) : Azzi Abdelmalek le 31 Août 2015
If data is your matrix
out=str2double(cellfun(@(x) regexp(x,'\d+','match'),data))
  1 commentaire
ARS
ARS le 31 Août 2015
Thanks Azzi, works great.

Connectez-vous pour commenter.

Plus de réponses (1)

Jan
Jan le 27 Oct 2015
Modifié(e) : Jan le 27 Oct 2015
str2double(strrep(data, 'S', ''))

Catégories

En savoir plus sur Cell Arrays dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by