Constants in MATLAB

前端 未结 8 912
孤城傲影
孤城傲影 2020-12-04 21:44

I\'ve come into ownership of a bunch of MATLAB code and have noticed a bunch of \"magic numbers\" scattered about the code. Typically, I like to make those constants in lan

8条回答
  •  生来不讨喜
    2020-12-04 22:01

    I usually just define a variable with UPPER_CASE and place near the top of the file. But you have to take the responsibly of not changing its value.

    Otherwise you can use MATLAB classes to define named constants.

提交回复
热议问题