Merge parts that make up the string
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello! I have a 1x5 string.
I would like to merge all the 5 parts that make up the string so that I have one overall string.
Between each string there must be a "_" symbol.
I have tried it this way
string_final = strcat(strPieces(1),"_", strPieces(2),"_", strPieces(3),"_", strPieces(4),"_", strPieces(5));
but I want to get the same result with something more generic and that can be directly referenced to the value 5 (as it might change).
For example:
number_of_string = 5;
string_final = strcat(strPieces(1:number_of_string), "_");
0 Commenti
Risposta accettata
dpb
il 27 Nov 2022
S=string(['A':'E'].'); % an arbitrary array of strings
join(S,"_") % join with underscore character
0 Commenti
Più risposte (0)
Vedere anche
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!