Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Variable output file name 1

Status
Not open for further replies.

bkal

Structural
Feb 27, 2003
270
I have developed a mathcad (V.11) sheet which writes output to an Excel file (Insert > Data > File output). I want to use the sheet to run a number of different cases and write to different Excel files. However, the Excel file name is set once the File output was created. One option is to disable output (by Disable Evaluation), and only activate once the file name is changed manually.

Is there another way to define the ouput file name at the begining of the sheet?

Thanks, bkal
 
Replies continue below

Recommended for you

I know that you can do what you want if you store your data using the WRITEPRN function instead of using the Excel output object.

You can use the strcat() function along with the num2str() function to stitch together a filename. For example, assuming that the variable v is changing every run and A is your data matrix,

WRITEPRN(strcat(strcat('datafile_',num2str(v)),'.dat') : A

Open up the file in Wordpad to see the format -- you should be able to import this into Excel easily.

In my opinion, Mathcad is severely lacking when it comes to the flexibility of it's string processing and file I/O functions. Maybe this has been improved in v13? Anyone know?

I wonder if it's possible to change the filename of the Excel output object using a VBscript-able object. But that's an entirely different animal altogether.

Another idea would be to embed the Mathcad object into the Excel sheet and use the much more robust Visual Basic for Applications to do all the automation. I think this is possible? Not sure.

HTH,
-Matt


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor