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

6 visualizaciones (últimos 30 días)
Malicule
Malicule el 10 de Jul. de 2017
Abierta de nuevo: Malicule el 10 de Jul. de 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!

Respuestas (0)

Categorías

Más información sobre Structures en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by