Plus, you should use num2str to display a number. Please replace
disp(n);
with
disp(num2str(n));
Best.
Nathan <ngreco32@gmail.com> wrote in message <d733956c58db41508bbcfc1dfc6cb9ab@p13g2000pre.googlegroups.com>...
> On Feb 19, 1:04 am, "Chris " <ridered30...@hotmail.com> wrote:
> > ok this is really frustrating...
> > I want each iteration of n to be in the same vector
> > I have:
> >
> > input = 200;
> > n = input;
> > while n > 38
> > n = round(n ./3 + 25);
> > disp(n) %shows the iterations of n
> > end
> > end
> >
> > When I do this it shows the iterations of n but I cannot do anything with them
> > I tried:
> >
> > vec = disp(k) but it comes up with an error.
> >
> > I looked on the forums and it seems like I need a for loop.
> > Any help?
>
> So, n = 200. 200 is not a vector. It is a single value.
> How do you expect to find a vector if you are only using a single
> value?
>
> If you want each changed value of n to be contained within a vector,
> you could so something along the lines of:
>
> input = 200;
> n = input;
> ii = 2;
> nlimit = 38;
> vec = zeros(1,25floor(exp(3))+1);
> vec(1) = n;
> while n > nlimit
> n = round(n ./3 + 25);
> disp(n) %shows the iterations of n
> vec(ii) = n;
> ii = ii + 1;
> end
>
> %%%%%%
>
> vec =
>
> 200 92 56 44 40 38
>
> If this isn't what you want, be more precise (please).
>
> Nathan
