Why does data deleted from the workspace after execution the code ?
11 ビュー (過去 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 で Workspace Variables and MAT Files についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!