Removing loaded variables from workspace after changing name with eval
Show older comments
Hi,
I have a large data set, where each filename goes as XX001 etc. each filename is also the name of the stuct in the workspace.
so i use eval to rename it:
DataFiles = dir('C:\MyFolderPath');
for i = 1:length(DataFiles)
SubjectName = DataFiles(i).name;
load(SubjectName); eval(['patient', ' = ', SubjectName, ';'])
end
since i want my code to fit all the data, i change the names.
but then, i'm left with the original file name in the workspace.
how can i delete it?
Thank you!
1 Comment
Stephen23
on 18 May 2020
"how can i delete it?"
Accepted Answer
More Answers (1)
Fangjun Jiang
on 18 May 2020
Use one example, figure out if you can use the code below. If not, use "clear" to delete variable from workspace.
Patient=load(SubjectName);
Patient=Patient.(SubjectName);
Categories
Find more on Tables 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!