From: Oleg Komarov on
"Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <i0cf95$eih$1(a)fred.mathworks.com>...
> Dear Jenya,
>
> > Could you please help me. I need to find a way to loop this for i=1:10. Any help would be appreciated. THANKS!!!
>
> I'm confused. Do you mean:
>
> for i=1:10
> gsod_temp1(ka) = regional_gsod1{index_r1(i)}(index_r2);
> gsod_temp2(ka) = regional_gsod2{index_r1(i)}(index_r2);
> ...
> end
>
> ??? Jan
Zdrastvuite Jenya,
this is what I meant...the simplest solution but that ka didn't make sense w/o an outer loop, which Jenya confirms exists.

Oleg
From: Andy on
I think Jenya is almost certainly looking for this:

for ka = 1:10 % <- outer loop
for ix = 1:10 % <- outer loop, also, don't use i, which is sqrt(-1) in MATLAB
for n = 1:10 % <- new loop
gsod_temp{n}(ka) = regional_gsod{n}{index_r1(ix)}(index_r2);
end
end
end

Notice how instead of have ten different arrays gsod_temp1, gsod_temp2, etc., you should have one cell array, gsod_temp, and index into it. The same goes for regional_gsod. This lets you easily loop over the different gsod_temp{n} and regional_gsod{n}.