Why does data deleted from the workspace after execution the code ?
18 次查看(过去 30 天)
显示 更早的评论
If I have the below code, why the data are erased from the workspace after finishing the excution of the code ?
function something
while
for i
calculations
end
if condition
break
end
end
end
0 个评论
采纳的回答
Image Analyst
2022-8-15
Because it's a function, not a script. Variables from a script wil remain in the base workspace after the script finishes. With functions, once the function finishes and returns, the variables internal to the function vanish.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!