http://www.mathworks.com/matlabcentral/newsreader/view_thread/324245
MATLAB Central Newsreader  loop problem
Feed for thread: loop problem
enus
©19942015 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Sat, 03 Nov 2012 19:56:10 +0000
loop problem
http://www.mathworks.com/matlabcentral/newsreader/view_thread/324245#890869
Isabel
Even though I can guess the problem here is about the definition of "a", I don't know how to solve the following error:<br>
<br>
for i = datenum(2012,9,18,7,08,00):datenum(0,0,0,0,0,1):datenum(2012,9,18,7,28,00); a=1:1200<br>
RE_7h23_T(a,:) = [i sum(RE_7h23_ID_T_timesorted(find (RE_7h23_ID_T_timesorted(:,1) == RE_7h23_ID_T_timesorted(1,1)),3))];<br>
end<br>
<br>
<br>
I can manage to do one line, but I don't know how to fix my matrix for every value of a! <br>
<br>
help please! thank you

Sat, 03 Nov 2012 21:34:13 +0000
Re: loop problem
http://www.mathworks.com/matlabcentral/newsreader/view_thread/324245#890873
Roger Stafford
"Isabel " <isabel.tovar@epfl.ch> wrote in message <k73ssq$o6$1@newscl01ah.mathworks.com>...<br>
> for i = datenum(2012,9,18,7,08,00):datenum(0,0,0,0,0,1):datenum(2012,9,18,7,28,00); a=1:1200<br>
> RE_7h23_T(a,:) = [i sum(RE_7h23_ID_T_timesorted(find (RE_7h23_ID_T_timesorted(:,1) == RE_7h23_ID_T_timesorted(1,1)),3))];<br>
> end<br>
         <br>
It isn't clear what result you expect in RE_7h23_T. As your code is at present, at each step in the forloop you have a twoelement vector on the right to be assigned simultaneously to a matrix on the right with 1200 rows. This won't work. The sum on the right side will always be the same so it isn't clear why you need the forloop. How many rows is RE_7h23_T expected to have?<br>
<br>
Roger Stafford