Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop output as input 1

Status
Not open for further replies.

Libertine3C

Electrical
Jul 29, 2011
2
Hi there

I have written a program that calculates averages of a very large set of data to reduce the amount of data I need to handle. I have attached the algorithm. My problem is that I want to run the algorithm a number of times with different starting values (more than I care to do manually) and get a number of outputs. The new starting values I want to use are output from the previous calculation.

In other words, I want to loop one of the outputs of my algorithm back in as an input and get a table of the results from each calculation.

If you look at the attached mathcad sheet I basically want the computer to automatically do Calc(0) then Calc(b) then Calc(c) x number of times, without having to write out x number of Calc()

Any help would be much appreciated, even if it is to say this is not possible!
 
Replies continue below

Recommended for you

You can add another function below your Calc function to do this. For instance:

Results(x):= | table<-Calc(0)
| index<-table[0,2
| for i = 1;x
| newtable<-Calc(index)
| table<-augment(table,newtable)
| index<-newtable[0,2
| table

You could also stack the results instead of augment depending on how you want to display them.

Peter
 
Peter, I can't thank you enough! Exactly the advice I needed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor