Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
matlab:检测修饰符+;按键中的字母FCN回调函数_Matlab - Fatal编程技术网

matlab:检测修饰符+;按键中的字母FCN回调函数

matlab:检测修饰符+;按键中的字母FCN回调函数,matlab,Matlab,如果将回调函数分配给图形的KeyPressFcn属性,则按下的键在字符、修改器和键字段的事件数据(matlab.ui.eventdata.KeyData)结构中可用 按Shift+c将返回具有以下属性的KeyDatastruct: Character: 'C' Modifier: {'shift'} Key: 'c' 但是,对于Alt+c,字符是难以理解的: Character: '￧' Modifier: {'alt'} Key: 'c' 字

如果将回调函数分配给图形的
KeyPressFcn
属性,则按下的键在
字符
修改器
字段的事件数据(
matlab.ui.eventdata.KeyData
)结构中可用

按Shift+c将返回具有以下属性的
KeyData
struct:

    Character: 'C'
    Modifier: {'shift'}
    Key: 'c'
但是,对于Alt+c,字符是难以理解的:

    Character: '￧'
    Modifier: {'alt'}
    Key: 'c'
字符的数值是
[2391167]
unicode2native(event_data.character,'UTF-8')

类似地,Ctrl+c返回一个未知字符

    Character: ''
    Modifier: {'control'}
    Key: 'c'
字符(
unicode2ntive
)的数值为
3


尽管通过
KeyData
struct的
key
字段始终可以使用该键,但是否可以通过转换返回值从
字符
字段检索该键?

基于以下情况,我会说否:

Character(字符):由于按下按钮而显示的字符 一把或几把钥匙。该字符可以为空或不可打印

钥匙:钥匙 被按下,由按键上的(小写)标签标识,或 描述性词语


Alt+c
Ctrl+c
不会在屏幕上打印任何内容,因此
Character
毫无意义。您应该使用

谢谢,关于字符与键的说明很有帮助。