Thread Subject: initialization of multi variable

Subject: initialization of multi variable

From: Arthur Zheng

Date: 6 Jul, 2009 15:19:01

Message: 1 of 3

If I want to initialize a number of variables to 0 as follows
count_Meso = 0;
count_Thermo = 0;
count_Hyper = 0;
count_Cryo = 0;
count_Psych = 0;
count_Nolabel = 0;

Is there a way to write them in one statement like c/c++?

Subject: initialization of multi variable

From: Matt

Date: 6 Jul, 2009 17:15:20

Message: 2 of 3

"Arthur Zheng" <hzheng7@gatech.edu> wrote in message <h2t4l5$787$1@fred.mathworks.com>...
> If I want to initialize a number of variables to 0 as follows
> count_Meso = 0;
> count_Thermo = 0;
> count_Hyper = 0;
> count_Cryo = 0;
> count_Psych = 0;
> count_Nolabel = 0;
>
> Is there a way to write them in one statement like c/c++?

Here's an example using the deal() function

 [a,b,c,d]=deal(0)


a =

     0


b =

     0


c =

     0


d =

     0

Subject: initialization of multi variable

From: Arthur Zheng

Date: 6 Jul, 2009 18:36:02

Message: 3 of 3

"Matt " <xys@whatever.com> wrote in message <h2tbf8$brg$1@fred.mathworks.com>...
> "Arthur Zheng" <hzheng7@gatech.edu> wrote in message <h2t4l5$787$1@fred.mathworks.com>...
> > If I want to initialize a number of variables to 0 as follows
> > count_Meso = 0;
> > count_Thermo = 0;
> > count_Hyper = 0;
> > count_Cryo = 0;
> > count_Psych = 0;
> > count_Nolabel = 0;
> >
> > Is there a way to write them in one statement like c/c++?
>
> Here's an example using the deal() function
>
> [a,b,c,d]=deal(0)
>
>
> a =
>
> 0
>
>
> b =
>
> 0
>
>
> c =
>
> 0
>
>
> d =
>
> 0

thanks.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
initialization ... Arthur Zheng 6 Jul, 2009 11:24:02
rssFeed for this Thread

Contact us at files@mathworks.com