在MATLAB中使用希腊字母(或任何非ANSI字母)作为变量名 [英] Using Greek alphabet (or any non-ANSI alphabet) as variable names in MATLAB
问题描述
在MATLAB中可以使用希腊字母表示变量吗?
Is it possible using Greek alphabet to represent variables in MATLAB?
例如,我想使用希腊字符epsilon作为MATLAB中的变量.我尝试插入\epsilon
,但是收到错误消息.
For example, I'd like to use the Greek character epsilon as a variable in MATLAB. I tried to insert \epsilon
but I received an error.
推荐答案
不可能.
我参考了Matlab文档的以下部分:
I refer to the following part of Matlab documentation:
有效名称
有效的变量名以字母开头,后跟字母, 数字或下划线. MATLAB区分大小写,因此A和a不区分大小写 相同的变量.变量名称的最大长度是值 namelengthmax命令返回.
A valid variable name starts with a letter, followed by letters, digits, or underscores. MATLAB is case sensitive, so A and a are not the same variable. The maximum length of a variable name is the value that the namelengthmax command returns.
字母定义为a-z
和A-Z
之间的ANSI字符.
例如,以下希伯来字母Aleph
返回false
(Matlab R2018a中的返回true ):
Letter is defined as ANSI character between a-z
and A-Z
.
For example, the following hebrew letter Aleph
returns false
(in Matlab R2018a returns true):
isletter('א')
顺便说一句,您始终可以使用genvarname
检查变量名是否正确.
By the way, you can always check whether your variable name is fine by using genvarname
.
genvarname('א')
ans =
x0x1A
这篇关于在MATLAB中使用希腊字母(或任何非ANSI字母)作为变量名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!