How do i clear all except one variable?
652 views (last 30 days)
Show older comments
Kritank Kalyan
on 18 Dec 2018
Commented: Matthew Creek
on 24 Aug 2023
I want to clear all variables except one
entering all variable to be cleared is a lengthy process, has many variables and function
0 Comments
Accepted Answer
Walter Roberson
on 18 Dec 2018
clearvars -except NAME
2 Comments
Pedapudi Bharath Raja Bhoopal
on 14 Dec 2020
Thankyou it worked
clearvars -except X %deletes all variables except X in workspace
Matthew Creek
on 24 Aug 2023
Here are some links to related documentation:
More Answers (0)
See Also
Categories
Find more on Workspace Variables and MAT Files 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!