필터 지우기
필터 지우기

Variables are stored but not shown is the workspace?

조회 수: 3 (최근 30일)
Yalc Copper
Yalc Copper 2023년 7월 5일
편집: John D'Errico 2023년 7월 5일
I type in ans=1 in command window and I can recall it and also can find it in the control tab. But the variable just does not appear in the workspace. I reviewed some questions but all of them are about functions or scripts. Please help me.

답변 (2개)

John D'Errico
John D'Errico 2023년 7월 5일
편집: John D'Errico 2023년 7월 5일
clear
x = 1;
ans = x+1
ans = 2
whos
Name Size Bytes Class Attributes ans 1x1 8 double x 1x1 8 double
As you can see, the variable ans does appear. HOWEVER, you should never be using ans as a variable! It is a reserved name, a variable name that will be overwritten frequently, and not under your control.
Even on my own computer, ans does show up in the workspace pane. So I am not sure what exactly you did. If you have some behavior that is confusing you, then you need to be more clear about it.

Fangjun Jiang
Fangjun Jiang 2023년 7월 5일
The variable name "ans" is reserved by MATLAB.
type "doc ans" to read it
  댓글 수: 2
Yalc Copper
Yalc Copper 2023년 7월 5일
it is not about ans or other variable names. I tried other names, and the variable just cannot show in the workspace
Fangjun Jiang
Fangjun Jiang 2023년 7월 5일
Try the following in MATLAB Command Window
a=1;
b=2;
workspace
open a

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

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by