Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make a "^" character in MATLAB?

^ is the exponential operator in MATLAB. The problem with it is that it isn't present on a lot of non-english keyboard layouts, and if you use it a lot in your work, switching between HR and EN becomes troublesome.

Is there a way to add it to MATLAB's toolbar (like in Excel, so you can use it via mouse or touchpad), or to define a custom key (for example, F12) in MATLAB to replace it?

I'm hoping for a non AHK solution, and the like.

like image 417
Rook Avatar asked Nov 18 '09 22:11

Rook


People also ask

How are characters represented in MATLAB?

You can represent text in MATLAB®using string arrays. Each element of a string array stores a sequence of characters. The sequences can have different lengths without padding, such as "yes" and "no" . A string array that has only one element is also called a string scalar.

How do you create a character vector?

How to create a character vector in R? Use character() or c() functions to create a character vector. character() creates a vector with a specified length of all empty strings whereas c() creates a vector with the specified values, if all values are strings then it creates a character vector.

How do you convert a number to a character in MATLAB?

s = num2str( A ) converts a numeric array into a character array that represents the numbers. The output format depends on the magnitudes of the original values. num2str is useful for labeling and titling plots with numeric values.

How do I save a character in MATLAB?

To store a 1-by- n sequence of characters as a character vector, using the char data type, enclose it in single quotes. The text 'Hello, world' is 12 characters long, and chr stores it as a 1-by-12 character vector. If the text includes single quotes, use two single quotes within the definition.


2 Answers

Create a toolbar shortcut, give it a name, and put the following in the callback:

clipboard('copy','^')

Running this will place the exponent character ^ in your clipboard. Once you press it, do a Ctrl+V to paste it.

You can apply this idea to create a clip library of snippets accessible from MATLAB's Start menu.

like image 81
Amro Avatar answered Sep 22 '22 21:09

Amro


In Windows (with Num Lock on), hold down Alt, type 94 on the numeric keypad, and release Alt. The ^ will be inserted at the cursor.

This is the general technique for inserting arbitrary Unicode characters in Windows, regardless of whether they're on the keyboard.

The ^ character is U+5E, which is 94 in decimal.

like image 33
Andrew Janke Avatar answered Sep 21 '22 21:09

Andrew Janke