integer variable

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

댓글 수: 1

Jan
Jan 2012년 4월 4일
I've deleted the duplicate question.

댓글을 달려면 로그인하십시오.

 채택된 답변

Wayne King
Wayne King 2012년 4월 4일

0 개 추천

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

댓글 수: 2

Titus Edelhofer
Titus Edelhofer 2012년 4월 4일
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 2012년 4월 4일
And in older versions this works efficiently:
clear('A') % On demand only!
A(10, 1) = int16(0);

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Titus Edelhofer
Titus Edelhofer 2012년 4월 4일

1 개 추천

Hi,
x = int32(42);
y = uint16(1);
Titus
Thomas
Thomas 2012년 4월 4일

0 개 추천

this might help: It is an introduction to MATLAB variables

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

태그

질문:

som
2012년 4월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by