<div dir="ltr">Hi Stefan,<div><br></div><div>Thank you for clarifying the meaning of the error message.</div><div><br></div><div>Lester</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 15 Aug 2021 at 11:59, Stefan Du Rietz <<a href="mailto:sdr@durietz.se">sdr@durietz.se</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello Lester,<br>
the problem is that seq in each loop is a vector of increasing length!<br>
<br>
Stefan<br>
<br>
<br>
On 2021-08-15 12:05, Lester Anderson wrote:<br>
> Hi Stefan,<br>
> <br>
> I did try that before, but got an error - "Submatrix incorrectly defined"<br>
> <br>
> Lester<br>
> <br>
> On Sun, 15 Aug 2021 at 10:56, Stefan Du Rietz <<a href="mailto:sdr@durietz.se" target="_blank">sdr@durietz.se</a> <br>
> <mailto:<a href="mailto:sdr@durietz.se" target="_blank">sdr@durietz.se</a>>> wrote:<br>
> <br>
> <br>
> <br>
> On 2021-08-15 09:00, Lester Anderson wrote:<br>
> > Hello,<br>
> ><br>
> > Basic query. I have a simple code that applies the Collatz<br>
> conjecture<br>
> > equation (3n+1) by running a function and then runs a loop over the<br>
> > values stored in prime (the first 8 Prime numbers):<br>
> ><br>
> > clear<br>
> ><br>
> > exec('collatz.sci',-1);<br>
> ><br>
> > prime = primes(20);<br>
> ><br>
> > for i = 1:length(prime)<br>
> > [ns, seq]=collatz(prime(i))<br>
> > end<br>
> ><br>
> > As it stands, this just runs to the end (i=8) and the value 19.<br>
> How can<br>
> > I get the code to write the results of each loop pass into the<br>
> variables<br>
> > ns and seq, such that each contains the results of the 8 passes?<br>
> ><br>
> > Can no longer search the forums online from the website.<br>
> ><br>
> > Thanks<br>
> > Lester<br>
> <br>
> <br>
> // Before the for loop:<br>
> ns = zeros(prime);<br>
> seq = ns;<br>
> <br>
> // Changed for loop<br>
> for i = 1:length(prime)<br>
> [ns(i), seq(i)]=collatz(prime(i))<br>
> end<br>
> <br>
> Regards<br>
> Stefan<br>
> _______________________________________________<br>
> users mailing list<br>
> <a href="mailto:users@lists.scilab.org" target="_blank">users@lists.scilab.org</a> <mailto:<a href="mailto:users@lists.scilab.org" target="_blank">users@lists.scilab.org</a>><br>
> <a href="http://lists.scilab.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.scilab.org/mailman/listinfo/users</a><br>
> <<a href="http://lists.scilab.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.scilab.org/mailman/listinfo/users</a>><br>
> <br>
> <br>
> _______________________________________________<br>
> users mailing list<br>
> <a href="mailto:users@lists.scilab.org" target="_blank">users@lists.scilab.org</a><br>
> <a href="http://lists.scilab.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.scilab.org/mailman/listinfo/users</a><br>
> <br>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@lists.scilab.org" target="_blank">users@lists.scilab.org</a><br>
<a href="http://lists.scilab.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.scilab.org/mailman/listinfo/users</a><br>
</blockquote></div>