How can I trim these strings according to the underscores

9 vues (au cours des 30 derniers jours)
Chiara Scarpellini
Chiara Scarpellini le 25 Juil 2021
Commenté : Chunru le 26 Juil 2021
I need to trim these strings according to the underscores, basically from every string I need to obtain 5 pieces
Novana_Model_B180_DK1_4284.0
Novana_Model_ALSTED_AA_DK1_7835.166666666666
Novana_model_Storaa_DK3_11535.0
DK_QNP_Aa51200001_DK3_1469.143
Novana_Model_MOELLERENDE_DK1_492.42857142857144
DK_QNP_Aa51200001_DK3_979.429
Novana_Model_MOELLERENDE_DK1_984.8571428571429
DK_QNP_Aa51200062_DK3_1961.2
DK_QNP_Aa51200062_DK3_4412.7
DK_QNP_Aa51200062_DK3_2451.5
Novana_model_Branch_73_DK3_1263.75
DK_QNP_Aa51200062_DK3_4412.7
Novana_model_Branch_73_DK3_1263.75
  2 commentaires
Chiara Scarpellini
Chiara Scarpellini le 26 Juil 2021
What if I want now to merge the part before the DK and keep the numbers at the end separated?
NovanaModelB180 4284.0
NovanaModelALSTEDAA 7835.166666666666
Chunru
Chunru le 26 Juil 2021
See below.

Connectez-vous pour commenter.

Réponse acceptée

Chunru
Chunru le 25 Juil 2021
Modifié(e) : Chunru le 26 Juil 2021
str = "Novana_Model_B180_DK1_4284.0"
str = "Novana_Model_B180_DK1_4284.0"
str1 = strsplit(str, '_')
str1 = 1×5 string array
"Novana" "Model" "B180" "DK1" "4284.0"
join(str1(1:4), '')
ans = "NovanaModelB180DK1"

Plus de réponses (0)

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by