I = eye(sz)
returns an array with ones on the main diagonal and zeros elsewhere. The size
vector, sz, defines size(I). For example,
eye([2,3]) returns a 2-by-3 array with ones on the main
diagonal and zeros elsewhere.
I = eye(___,typename)
also specifies the data type (class) of I for any of the
previous syntaxes. For example, eye(5,"int8") returns a
5-by-5 identity matrix consisting of 8-bit integers.
typename must be a built-in
MATLAB® numeric type. Does not invoke the static
eye method for other classes. For example,
eye(m, n, 'myclass') does not invoke
myclass.eye(m,n).
Size arguments must have a fixed size.
Usage notes and limitations:
typename must be a built-in MATLAB numeric type. Does not invoke the static
eye method for other classes. For example,
eye(m, n, 'myclass') does not invoke
myclass.eye(m,n).
The eye function
supports GPU array input with these usage notes and limitations:
You can specify typename as 'gpuArray'. If you specify
typename as 'gpuArray', the default underlying
type of the array is double.
To create a GPU array with underlying type datatype,
specify the underlying type as an additional argument before
typename. For example, I =
eye(3,datatype,'gpuArray') creates a 3-by-3 GPU identity
matrix with underlying type datatype.
You can specify the underlying type datatype as one of these
options:
'double'
'single'
'logical'
'int8'
'uint8'
'int16'
'uint16'
'int32'
'uint32'
'int64'
'uint64'
You can also specify the numeric variable p as a
gpuArray.
If you specify p as a gpuArray, the underlying type of the
returned array is the same as p.
You can specify typename as 'codistributed' or
'distributed'. If you specify typename as
'codistributed' or 'distributed', the default
underlying type of the returned array is double.
To create a distributed or codistributed array with underlying type
datatype, specify the underlying type as an
additional argument before typename. For example,
I = eye(3,datatype,'distributed') creates a 3-by-3
distributed identity matrix with underlying type
datatype.
You can specify the underlying type datatype as one of these
options:
'double'
'single'
'logical'
'int8'
'uint8'
'int16'
'uint16'
'int32'
'uint32'
'int64'
'uint64'
You can also specify p as a codistributed or distributed array.
If you specify p as a codistributed or
distributed array, the underlying type of the returned array is the same
as p.
For additional codistributed syntaxes, see eye
(codistributed) (Parallel Computing Toolbox).
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.