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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Create variable names automatically

rhanet
7-Bedrock

Create variable names automatically

Greetings colleagues of the forum, I have the following query:
How to create variable names automatically?
By programming a loop I get the names of variables but as text strings, I want to get a matrix like the one marked in red?

 

crear variables automaticamente.png

 

 

 

Is there any way to do it in Mathcad Prime 4?

I would appreciate any suggestions.

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:rhanet)

The closest you may come to is using matrix variables.

It depends on your needs if this can be useful for you.

B.PNG

View solution in original post

7 REPLIES 7
Fred_Kohlhepp
23-Emerald I
(To:rhanet)

There is a string to number function; but it will not create variable names.  Short of some fancy coding (which Prime still won't do) there's no way.

Hello FredKohlhepp, thanks for your comment. I agree with what you say, I found that in Mathcad 15 there is a script to do it; but the problem is that I'm working with Mathcad Prime on this.

Werner_E
25-Diamond I
(To:rhanet)

The closest you may come to is using matrix variables.

It depends on your needs if this can be useful for you.

B.PNG

rhanet
7-Bedrock
(To:Werner_E)

Hello Werner_E, thanks for your suggestion. I had already tried it but since I have to do operations later I get an error and it does not work. However some operations can be performed.

I am reformulating my problem in other ways so as not to have to use numbered variables.

DJF
16-Pearl
16-Pearl
(To:Werner_E)

I'm just thinking out loud here, but is there any possibility of using the Custom Functions and calling C or FORTRAN code as a workaround to this problem?  I've never used them, but it seems to open up some possibilities.

Fred_Kohlhepp
23-Emerald I
(To:DJF)


@DJF wrote:

I'm just thinking out loud here, but is there any possibility of using the Custom Functions and calling C or FORTRAN code as a workaround to this problem?  I've never used them, but it seems to open up some possibilities.


Interesting!

 

I never realized that was there.  Does anyone know if it could be done in Express?

LucMeekes
23-Emerald III
(To:DJF)

In Mathcad 11, through symbolic operation, you can rename variables to a certain extent. Tom Gutman showed how to do that long ago.

As far as I know there are two ways to create new variables, one is through the user interface. If you can control the application's user interface from within executable code, you have a possibility to create new variables.

The other way is outside of the application, by manipulating the sheet file (.mcd, .xmcd or .mcdx file).

 

Success!

Luc

Announcements

Top Tags