From: David Young on 21 Mar 2010 06:45 It's not clear why you need each result saved in a different variable. Why not use an array? - it's much simpler. It sounds like a struct array would be right, though a cell array would be another possibility. There is very good documentation for these, so I won't give examples here.
From: Bruno Luong on 21 Mar 2010 08:03 % Put your data as cell C = {Cx, Cy, Cz, Cl, Cm, Cn} for Ci=C % do domething with Ci{1} end % OR in struct names = {'Cx' 'Cy' 'Cz' 'Cl' 'Cm' 'Cn'} S = struct('name', names, 'data', {Cx, Cy, Cz, Cl, Cm, Cn}) for Si = S % do something with Si.data end % Or in containers.Map names = {'Cx' 'Cy' 'Cz' 'Cl' 'Cm' 'Cn'}; data = {Cx, Cy, Cz, Cl, Cm, Cn}; c = containers.Map(names,data) for key=names ci = c(key{1}); % do something with ci end % Bruno
First
|
Prev
|
Pages: 1 2 Prev: Multiobjective Optimization using Genetic Algorithm Next: Suppression of Carriage Return. |