Group fields of structure with same first n letters of field name

6 vues (au cours des 30 derniers jours)
Malicule
Malicule le 10 Juil 2017
Rouvert : Malicule le 10 Juil 2017
Hi, My data looks like this:
image1_control,
image1_drug,
image1_drug2,
image2_control,
image2_drug2,
image3_drug,
image4_control,
image4_drug2,
etc
These are all field names of a structure.
I would like to group field names based on the first 7 characters of the string. For example, I want to create a structure named image1 with subfields named control, drug1 and drug2.
I have tried using strcmp, but I would have to create a for loop to conduct a pairwise comparison. I'm having trouble using regexp and indexing all "images" with the matching names.
Can someone help me find a more efficient way to group field names that share the first 7 characters?
Thanks!

Réponses (0)

Catégories

En savoir plus sur Structures dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by