How to make the output of a command into the variable for data

2 visualizzazioni (ultimi 30 giorni)
Hello,
I am using fileparts to extract the file names and use that as the variable for the data in the struct below. How do I make output "Patient001" as the variable name for the struct that is currently called "PatientData"? without having to manually doing it. Eventually I want to be able to loop through hundreds of patient files.
Thank you
file = "Patient001.pdf";
[pathstr,PatientName,ext] = fileparts(file)
PatientName =
"Patient001"
PatientData = {1, 2, 3, 4}

Risposta accettata

Cris LaPierre
Cris LaPierre il 12 Gen 2022
Modificato: Cris LaPierre il 12 Gen 2022
You might also be interested in the RenameField function, available on the File Exchange (created by a community member).

Più risposte (0)

Categorie

Scopri di più su Structures in Help Center e File Exchange

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by