integer variable

Hi all,
how can I define an integer variable at the begining of program?
thank you in advance;

1 comentario

Jan
Jan el 4 de Abr. de 2012
I've deleted the duplicate question.

Iniciar sesión para comentar.

 Respuesta aceptada

Wayne King
Wayne King el 4 de Abr. de 2012

0 votos

Can you be more specific. You can do something like.
A = int16(zeros(10,1));
but whether that is what you need depends.

2 comentarios

Titus Edelhofer
Titus Edelhofer el 4 de Abr. de 2012
Hi Wayne,
in newer versions you might write zeros(10, 1, 'int16'): esp. interesting for large arrays, since it doesn't generate a double array first and convert later but creates the int16 array directly.
Titus
Jan
Jan el 4 de Abr. de 2012
And in older versions this works efficiently:
clear('A') % On demand only!
A(10, 1) = int16(0);

Iniciar sesión para comentar.

Más respuestas (2)

Titus Edelhofer
Titus Edelhofer el 4 de Abr. de 2012

1 voto

Hi,
x = int32(42);
y = uint16(1);
Titus
Thomas
Thomas el 4 de Abr. de 2012

0 votos

this might help: It is an introduction to MATLAB variables

Categorías

Etiquetas

Preguntada:

som
el 4 de Abr. de 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by