Azzera filtri
Azzera filtri

How can I trim these strings according to the underscores

4 visualizzazioni (ultimi 30 giorni)
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 Commenti
Chiara Scarpellini
Chiara Scarpellini il 26 Lug 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

Accedi per commentare.

Risposta accettata

Chunru
Chunru il 25 Lug 2021
Modificato: Chunru il 26 Lug 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"

Più risposte (0)

Categorie

Scopri di più su Characters and Strings in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by