How to make the output of a command into the variable for data
2 views (last 30 days)
Show older comments
Nadeau Hahne
on 12 Jan 2022
Edited: Cris LaPierre
on 12 Jan 2022
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}
0 Comments
Accepted Answer
Cris LaPierre
on 12 Jan 2022
Edited: Cris LaPierre
on 12 Jan 2022
You might also be interested in the RenameField function, available on the File Exchange (created by a community member).
0 Comments
More Answers (0)
See Also
Categories
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!