cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Could I know how to execute a math region (in the current worksheet or another worksheet as well) repeatedly

0 Kudos

Could I know how to execute a math region (in the current worksheet or another worksheet as well) repeatedly

I would like to have some functionality similar to Go Sub or Subroutine. I tried to do this using WRITEEXCEL, but WRITEEXCEL doesn't take variable: it works for values only.

The aim is to do repeated calculations over a math region located within the current worksheet and outside the current worksheet as well. This math region is different from a user defined function but composed of general equations, solve block(s) and programs made using If.....Then so on. Basically, it exports variables to the remote math region (or worksheet) and returns to the current worksheet with results and continue.

Is there a way to achieve this functionality?

Look forward to receiving comments.

Thanks.

Roy Wickrama

7 Comments
RichardJ
19-Tanzanite

What you want to do is really not possible. There is no way to force calculation of an individual math region. You can loop through the calculation of some regions using tricks with the animation tool, but it's a kludge. You can call another worksheet from a scripted component, but it requires some programming and the target worksheet has to be modified at least slightly.

The right way to call multiple regions repeatedly is to write everything as functions. The functions can then be called from a program that loops though them as many times as required.

RWickrama
6-Contributor

Thank you for your reply..

I go back to my memories. When I used Fortran IV in early 80s, I used this functionality: GOSUB and SUBROUTINE. These things pops-up when I use Mathcad Prime 2.0 for my calculation purposes.

I couldn't use much programming because I started to work in the machinery and equipment maintenance - but now I am back in design of machinery and equipment. I am exploring calculation strategies. I am surprised why such a functionality we had a longtime ago not available at present. I will keep exploring.

Best Regards.

Roy Wickrama

RichardJ
19-Tanzanite

A lot of languages do not have subroutines, only functions (C for example). But a function is really just a subroutine with a return value. Everything in Mathcad can be written in the form of a function (including solve blocks), and those functions can then be called by other functions or programs. So what you want is there, just not in quite the way you are thinking of it.

RWickrama
6-Contributor

Your reply helped me to explore and I got it done. Basically, I defined the parameters in other previous files and got returned the results in to the current worksheet (by maintaining the order of files in sequence). This has some disadvatage that the final working file doesn't have the option to input all the design parameters: must open the respective file to view and edit as well. Same for printing the full calculations document. To make it worse, currently the Mathcad Prime "INCLUDE<<" functionality doesn't have an option to open the file included from within the current worksheet: I know this option is in the ToDo list.

Basically, I enjoy Mathcad Prime versions. It is very good unless some minor problems. I am doing a lot and keep continue. Eventually, it will be fine.

Roy Wickrama

mzeftel
1-Newbie

Rohanna and others,


If you have a current maintenance account, please post your suggestions under the Ideas section, where people can vote on them.


http://communities.ptc.com/community/mathcad?view=idea

Mona

RWickrama
6-Contributor

I have a maintenance account for Mathcad Prime 2.0. Is it OK.

Pl. reply.

Best Regards.

Roy Wickrama

olivierlp
Community Manager
Status changed to: Archived

Hello,

We are archiving your idea as part of a general review. This action is based on the age of your idea and the total number of votes received, as per this announcement.

You can always post a new idea with all the details required in the form.

Thank you for your participation.