[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Creating "sequential variable names"
From: |
John W. Eaton |
Subject: |
Re: Creating "sequential variable names" |
Date: |
Tue, 19 Oct 2010 03:36:09 -0400 |
On 19-Oct-2010, AlbFrigerio wrote:
| Thanks a lot jwe, it looks very simple, as all the right things should be. I
| implemented it and everything works without using eval or something like
| that.
|
| > I think it is even clearer if you write
| >
| > for i = 1:10
| > AG(i).P.n = 1;
| > AG(i).M.err = 0;
| > endfor
| >
| > to create a struct array.
I should also mention that if you have a large number of elements in
your struct array, the above will be somewhat slow because AG will be
resized each time through the loop. It will be faster to write
something like
for i = 10:-1:1
..
end
so that resizing happens only once.
jwe
- Re: Creating "sequential variable names", (continued)
- Re: Creating "sequential variable names", Andy Buckle, 2010/10/18
- Re: Creating "sequential variable names", Søren Hauberg, 2010/10/18
- Re: Creating "sequential variable names", AlbFrigerio, 2010/10/18
- Re: Creating "sequential variable names", Ben Abbott, 2010/10/18
- Re: Creating "sequential variable names", Søren Hauberg, 2010/10/18
- Re: Creating "sequential variable names", AlbFrigerio, 2010/10/18
- Re: Creating "sequential variable names", John W. Eaton, 2010/10/18
- Re: Creating "sequential variable names", Sergei Steshenko, 2010/10/18
- Re: Creating "sequential variable names", John W. Eaton, 2010/10/18
- Re: Creating "sequential variable names", AlbFrigerio, 2010/10/19
- Re: Creating "sequential variable names",
John W. Eaton <=
- Re: Creating "sequential variable names", AlbFrigerio, 2010/10/19
- Re: Creating "sequential variable names", Jaroslav Hajek, 2010/10/19