Is it possible to assign multiple variables to one number?

For example, is there a much more efficient way of doing this:
a = 0;
b = 0;
c = 0;
And so on; essentially, I am trying to set a-z equal to 0. I am just trying to make my script seem less long. Thank you for the help.

 채택된 답변

Jan
Jan 2015년 11월 7일
If you really have 26 variables with a single charater name 'a' to 'z' which are all scalars, use one vector:
a = zeros(1, 26);
and a(2) instead of b.

추가 답변 (2개)

Bharath Rangaswamy
Bharath Rangaswamy 2015년 11월 6일

0 개 추천

Hi Shawn,
There is no way to assign multiple variables to one number.
Best,
Bharath

카테고리

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

질문:

2015년 11월 4일

댓글:

2023년 6월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by