Symbol Symbol Name Role Description Examples~ Tilde- Logical NOT
- Argument placeholder
Use the tilde symbol to represent logical NOT or to suppress specific input or output arguments.- not
- “Ignore Function Inputs” on page 21-13
- “Ignore Function Outputs” on page 1-4
Calculate the logical NOT of a matrix:A = eye(3);
~ADetermine where the elements of A are not equal to those of B:A = [1 -1; 0 1]
B = [1 -2; 3 2]
A~=BReturn only the third output value of union:[~,~,iB] = union(A,B)= Equal sign AssignmentUse the equal sign to assign values to a variable. The syntax B = A stores the elements of A in
variable B.NoteThe = character is for assignment, whereas the == character is for comparing the elements in
two arrays. See eq for more information.Create a matrix A. Assign the values in A to a new variable, B. Lastly, assign a new value to the first element in
B.A = [1 0; -1 0];
B = A;
B(1) = 200;String and Character Formatting
Some special characters can only be used in the text of a character vector or string. You
can use these special characters to insert new lines or carriage returns, specify folder
paths, and more.Use the special characters in this table to specify a folder path using a character vector or
string.Symbol Symbol Name Role Description Examples/
\
Slash and Backslash File or folder path separationIn addition to their use as mathematical operators, the slash and backslash
characters separate the elements of a path or folder. On Microsoft Windows based
systems, both slash and backslash have the same effect. On The Open Group UNIX
based systems, you must use slash only.On a Windows system, you can use either backslash or slash:dir([matlabroot '\toolbox\matlab\elmat\shiftdim.m'])
dir([matlabroot '/toolbox/matlab/elmat/shiftdim.m'])On a UNIX system, use only the forward slash:dir([matlabroot '/toolbox/matlab/elmat/shiftdim.m'])2 Program Components