Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


Mike
Posts:
338
Registered:
4/17/07


Re: if not clear memory then the results are wrong
Posted:
Jul 26, 2013 1:27 AM


On Friday, July 26, 2013 11:23:48 AM UTC+8, dpb wrote: > ... > > > I have several row vectors. > > > I tranpose them with > > > A=A';B=B';C=C'; % I want to save them as column vectors > > > But A,B,C are still row one. > > > I run above procedures several times. > > > > > > After I 'clear all', rerun it and they are column vector. > > > Why? > > > > Something you're not showing... > > > > 
It is like: m=0; for i=1:nimg % .... function returns a variable: var if(isempty(var)) m=m+1; img{m}=img0{i}; % img0 : cell array storing strings continue; end end img=img';
There is an warning about img: "variable appears changing on every loop." and it sugggests to preallocate the variable. I run two times and found first time is img is in column vector and the second time img is in row vector. I thought changing size variable is ok.



