필터 지우기
필터 지우기

Is it necessary to clear variables before writing the same variable (updated contents) to workspace?

조회 수: 1 (최근 30일)
Kind of a silly question about a very fundamental thing. I forgot if Matlab always completely overwrites a variable if I reassign it. Or is it possible that some old content will remain if the old variable had more fields, elements, etc? More specifically, I have a GUI where one of the buttons is to send a couple structures (named "S" and "S2") to the base workspace in case I want to play around with them.
If I already had S and S2 in the base workspace from before, is there any need or reason to clear them in the base workspace prior to executing this line
assignin('base','S','S')
  댓글 수: 2
Image Analyst
Image Analyst 2017년 2월 16일
편집: Image Analyst 2017년 2월 16일
Try it and see. By the way, sending structures to the base workspace is probably not a good idea. I never do this, and most programmers probably don't either. It's not needed for well written code.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by