필터 지우기
필터 지우기

>>x gives 1.598........ when x hasnt been assigned

조회 수: 3 (최근 30일)
robin teslar
robin teslar 2019년 12월 14일
댓글: Walter Roberson 2019년 12월 16일
I thought I was on a clean sheet with x,y,z default to zero
>> x
x =
1.598053182478617
>>
why do I get this?
*******************
different variable y
>> y
y =
Columns 1 through 3
-0.000000000000000 -0.024544308631620 -0.049092313081569
Columns 4 through 6
-0.073647707492896 -0.098214182642028 -0.122795424215234
Columns 7 through 9...................................... to cols 513
**************************
and again with z
>> z
z =
2.557407724654902
>>
am I not resetting correctly?
I thought that "click clear" command page would reset all?
Sorry for newbie dumb question, I dont know where to go on this
Robin

채택된 답변

Image Analyst
Image Analyst 2019년 12월 14일
Put this in the command window:
>> workspace
Now, do you see x, y, and z in the workspace panel BEFORE you type x in the command window? Yes you do. Double click on x in the workspace panel to bring it up in the variable editor. Do you see a value there? Yes. Now type x on the command line and you will see the same value.
Do you want to get rid of all variables? Do this
>> clearvars
Now when you type x it will say
Unrecognized function or variable 'x'.

추가 답변 (1개)

robin teslar
robin teslar 2019년 12월 14일
OK so command window assignments => workspace
Clear command window doesnt clear workspace
creating a new script doc still leaves old command stuff in the workspace
so you really need to know "clearvars" assume (click clear workspace does the same thing)?
Phew
Coming from an Excel bg I expect a new worksheet to be blank but I think I can see the reasoning
what worried me is, if you had developed a long script and your vars hadnt been initialised correctly to default - I guess this becomes obvious. I am not a script kiddie obviously, dont know C
Thnx :-)
Robin
  댓글 수: 11
robin teslar
robin teslar 2019년 12월 16일
So clear needs to be used with care
As Mick Jagger said - you cant always get what you want
thanx
Robin
Walter Roberson
Walter Roberson 2019년 12월 16일
In my experience, when GUI are being discussed, the convention to indicate selection of a sub-entry or a sequence of steps some of which might only be possible on menus triggered by earlier stages, is to use -> between the parts. Using / is usually reserved for command line usage on Unix or DEC VMS systems (but not CP/M because CP/M predated hierarchy of command options)

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

카테고리

Help CenterFile Exchange에서 System Commands에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by