help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating "sequential variable names"


From: Søren Hauberg
Subject: Re: Creating "sequential variable names"
Date: Mon, 18 Oct 2010 16:02:20 +0200

man, 18 10 2010 kl. 06:55 -0700, skrev AlbFrigerio:
> Søren, you are completely right, but I'm not (yet) so crazy to create 100
> variables instead of using a vector :) . I just proposed an example, I just
> needed to know ho to create sequential names.

If you need to store something more complicated than numbers in the
variables, you should consider using a cell array. Something like

  b = cell (3, 1);
  b {1} = "This corresponds to b_1";
  b {2} = complex (3, 1);
  b {3} = "And this corresponds to b_3";

and so forth.

I once (many years ago) had to maintain some software another guy wrote
that used sequential variable naming and it was a major pain. For your
own mental wellness I would really consider another solution than using
b1, b2, ... :-)

Cheers
Søren



reply via email to

[Prev in Thread] Current Thread [Next in Thread]