From: Vibhash Jha on
I want to vary two parameters simultaneously in a for loop. What should i do?

for example
for c1=[1;2;3] && c2=[4;5;6]
t = c1+c2
end

This code doesn't work . but the idea is to use pair of c1 and c2 in each loop.

Please help.
From: Matt J on
"Vibhash Jha" <vibhash_iit(a)yahoo.com> wrote in message <hr5q87$pfi$1(a)fred.mathworks.com>...
> I want to vary two parameters simultaneously in a for loop. What should i do?
>
> for example
> for c1=[1;2;3] && c2=[4;5;6]
> t = c1+c2
> end
>
> This code doesn't work . but the idea is to use pair of c1 and c2 in each loop.
>
> Please help.

for c=[1 2 3; 4 5 6]
t=c(1)=c(2);
end
From: us on
"Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hr5u23$q8q$1(a)fred.mathworks.com>...
> "Vibhash Jha" <vibhash_iit(a)yahoo.com> wrote in message <hr5q87$pfi$1(a)fred.mathworks.com>...
> > I want to vary two parameters simultaneously in a for loop. What should i do?
> >
> > for example
> > for c1=[1;2;3] && c2=[4;5;6]
> > t = c1+c2
> > end
> >
> > This code doesn't work . but the idea is to use pair of c1 and c2 in each loop.
> >
> > Please help.
>
> for c=[1 2 3; 4 5 6]
> t=c(1)=c(2);
> end

???
us
From: Michael on
Try the following. Might be some kind of workaround, but it works:

c1 = [1 2 3]';
c2 = [4 5 6]';

for i = 1 : length(c1)
t = c1(i)+c2(i)
end
From: Steven Lord on

"us " <us(a)neurol.unizh.ch> wrote in message
news:hr62o7$kqq$1(a)fred.mathworks.com...
> "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message
> <hr5u23$q8q$1(a)fred.mathworks.com>...
>> "Vibhash Jha" <vibhash_iit(a)yahoo.com> wrote in message
>> <hr5q87$pfi$1(a)fred.mathworks.com>...
>> > I want to vary two parameters simultaneously in a for loop. What should
>> > i do?
>> >
>> > for example for c1=[1;2;3] && c2=[4;5;6]
>> > t = c1+c2
>> > end
>> >
>> > This code doesn't work . but the idea is to use pair of c1 and c2 in
>> > each loop.
>> >
>> > Please help.
>>
>> for c=[1 2 3; 4 5 6]
>> t=c(1)=c(2);
>> end
>
> ???
> us

Matt accidentally forgot to press Shift.

for c = [1 2 3;4 5 6];
t = c(1)+c(2);
end

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ