Abnormal trailing ^ on input
8 views (last 30 days)
Show older comments
I have suddenly run into a strange problem. Now, when pressing ^, my command line (not the editor) enters an abnormal state, writing ^ (underscored) AFTER the last of any subsequent input characters. The trailing ^ only disappears after pressing Enter (without its usual effect). The problem prevails after exiting and reopening matlab, and even after restarting the computer. Any solution or hint?
4 Comments
Stephen23
on 26 Sep 2024
Many keyboard layouts use a dead key for the caret: https://kbdlayout.info/features/deadkeys
Are you using one of those?
José María
on 26 Sep 2024
Moved: Voss
on 26 Sep 2024
Thaks for all the comments.
Yes, I am using Ubuntu 24.04 and a Spanish keyboard with dead keys.
Normally, I type ^ and nothing appears, then I press the space bar and ^ appears, and then I type the next character. The problem arose while I was typing in the command line, but I do not remember the exact sequence of keys. No error message.
Now, when I press ^, it already appears underscored. If I continue typing, everything appears BEFORE the underscored ^. The spacebar has no effect. The backspace key erases that typed text but not the trailing ^. The Enter key does supress the trailing ^ and recovers normal typing (without executing the command).
Answers (2)
Sumukh
on 27 Sep 2024
Hi Jose,
You can try out the following workarounds for the issue:
- The “power” function can be used instead of the “^” operator.
- Disable the dead key sequences. This prevents from using the characters that correspond to these sequences. There are two ways to disable the dead keys: using “setxkbmap” or “dpkg-reconfigure”.
Use setxkbmap
Before starting MATLAB, from the shell prompt type
setxkbmap -variant nodeadkeys
After exiting MATLAB, from the shell prompt type
setxkbmap -variant basic
Use dpkg-reconfigure
Type
dpkg-reconfigure xserver-xfree86
When the system prompts you to select the keyboard variant, choose nodeadkeys.
3. Remap the keys, i.e., use a different key combination for entering the “^” character. This remaps the key for all applications for the entire session, not just for MATLAB. The change only works for the current session, so you must remap the key again after you log off and log back on. Please follow these steps to remap a key using the command “xmodmap”:
- Determine the key you want to use as a substitute for the “^” operator. For example, you could remap the F11 key to type a caret (^).
- Use “xmodmap” to see what your current keymap looks like:
xmodmap -pke | more
This displays a table of values and a description of the behavior for each key.
Note the line that contains the key you want to remap. As an example, for a Finnish Keyboard, the line might be:
95 0xffc8 (F11)
- Find the decimal representation of the ASCII key that you want to map.
Most Linux systems display a map when you run this command:
man ascii
The output includes the following:
The Ascii value of the caret (^) character is decimal 94.
- Remap the key using xmodmap. To set the F11 key to input a caret (^) character, type:
xmodmap -e "keycode 95 = 94"
- Test the new key binding.
I hope this helps resolve the issue.
0 Comments
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!