×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Variable output file name

Variable output file name

Variable output file name

(OP)
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

RE: Variable output file name

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


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close