Prev: power_dstatcom_pwm, change capacity
Next: import data from excel 2007 with more than 65536 rows to matlab
From: Vibhash Jha on 27 Apr 2010 00:47 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 27 Apr 2010 01:52 "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 27 Apr 2010 03:12 "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 27 Apr 2010 03:32 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 27 Apr 2010 09:47
"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 |