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

Create variable names automatically

SOLVED
Highlighted
Regular Member

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.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Create variable names automatically

The closest you may come to is using matrix variables.

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

B.PNG

7 REPLIES 7

Re: Create variable names automatically

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.

Re: Create variable names automatically

The closest you may come to is using matrix variables.

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

B.PNG

Re: Create variable names automatically

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.

Re: Create variable names automatically

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.

Re: Create variable names automatically

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.

Re: Create variable names automatically


@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?

Re: Create variable names automatically

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