Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Dear all,
As briefly described in the object, I’m looking for a solution that allows to convert a “string name” already defined in an Excel sheet to a variable name into the Mathcad Prime 6.0 doc.
Actually, I’m using the READEXCEL function to import string and values that will be used as the inputs for the rest of the Mathcad computation work. With reference to the figure attached, I’m trying to simply associate one-to-one the “meters_var” to the “meters_val”.
I think that working with an external input sheet is more robust to the variation of variable names and quantity and relative values, making the approach more automatic since the Excel formats are interfaceable with most of computation programs.
Thanks in advance for your help
Solved! Go to Solution.
Attached is a Prime 4.0 Express sheet trying to demonstrate what I was saying above.
I assume that you want the items in meters_var to become actual Mathcad variables with the values from meters_val, correct?
I believe (without actually seeing it) that in the distant past there was a script that could accomplish that; but you're using Prime and I don't think it supports scripts yet, or no one has written one. I used to do what you've done and use the array subscripts to track who was who (meters_var4 will return the name while meters_var4 returns the required value).
What does work in Prime (sort of) is using tables:
It's messy, convoluted, time consuming. If you have a lot of files with the same names you'd only have to do it once; you could read the second, third, etc set of values in once the names have been assigned.
Good luck.
First of all, thanks for your reply.
Yes, I think you pinpoint the matter. But the strategy you used with the array subscripts is not applicable to my goal since the idea is to left the user free to move string and value position in the excel columns. And this is what really happen.
Concerning your suggestion in manipulating rows and arrays in excel, I think that’s what I will do regretfully by creating an excel matrix in Mathcad directly.
It's a shame because we loose the possibility to interface Mathcad with other software and, perhaps, to accomplish an iteration automatically.
Thank you again,
regards
You can pass array notations as arguments to functions.
CFFT(meters_val3) works just as well as CFFT(CwT). So tracking variable by indices is a viable work-around. (I was importing data from EXCEL files where the names were across the top of the column, and the column was a sampled time history of that parameter. But the files were not always ordered the same so I had to search the name list for the parameter of interest.)
Sorry, I'm not sure I understood your last suggestion.
I tried to implement what you said as in attached. Where I failed? Can you please provide a brief example on how actuate that? I will appreciate a lot.
Thank you so much for you help.
Regards
Attached is a Prime 4.0 Express sheet trying to demonstrate what I was saying above.
Yes, that's exactly what I hoped to do!
Thank you very much for your help.
Best Regards