help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issue with the variable after exiting for loop


From: Brett Green
Subject: Re: Issue with the variable after exiting for loop
Date: Thu, 28 May 2020 18:20:38 -0400


On Thu, May 28, 2020 at 3:14 PM Nicholas Jankowski <jankowskin@asme.org> wrote:

you shouldn't have to declare abc_p. that loop will assign element by element into abc_p, expanding it each time the size needs to increase for the assignment. this could get very slow for large arrays, as you are creating a copy of abc_p every time it needs to expand the size.  

Thank you for pointing that out - I hadn't considered that an expanding array would need to be re-defined and copied each time a new element is added. Here's another good coding practice for me to keep in mind.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]