Effacer les filtres
Effacer les filtres

integer variable

116 vues (au cours des 30 derniers jours)
som
som le 4 Avr 2012
Hi all,
how can I define an integer variable at the begining of program?
thank you in advance;
  1 commentaire
Jan
Jan le 4 Avr 2012
I've deleted the duplicate question.

Connectez-vous pour commenter.

Réponse acceptée

Wayne King
Wayne King le 4 Avr 2012
Can you be more specific. You can do something like.
A = int16(zeros(10,1));
but whether that is what you need depends.
  2 commentaires
Titus Edelhofer
Titus Edelhofer le 4 Avr 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 le 4 Avr 2012
And in older versions this works efficiently:
clear('A') % On demand only!
A(10, 1) = int16(0);

Connectez-vous pour commenter.

Plus de réponses (2)

Titus Edelhofer
Titus Edelhofer le 4 Avr 2012
Hi,
x = int32(42);
y = uint16(1);
Titus

Thomas
Thomas le 4 Avr 2012
this might help: It is an introduction to MATLAB variables

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by