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

Community email notifications are disrupted. While we are working to resolve, please check on your favorite boards regularly to keep up with your conversations and new topics.

Export to XML file

YA_10963798
11-Garnet

Export to XML file

Is it possible to export Mathcad sheet to XML file in version 9 prime?

If so, how?

Thanks 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi,

 

A *,mcdx Prime file is actually a compressed zip file of subdirectories of xml files

 

Step 1) Copy the *.mcdx file so you do not loose the file.

Step 2) In windows explorer change view | show | file extensions if not already set

Step 3) Change the file extension from *.mcdx to *.zip

Step 4) Unzip this now archive file

You now have a collection of subdirectory and xml files.

 To go back after making any changes: is to zip the subdirectories and change the extension back to *.mcdx.

 

Cheers

Terry

 

View solution in original post

14 REPLIES 14

Hi,

 

A *,mcdx Prime file is actually a compressed zip file of subdirectories of xml files

 

Step 1) Copy the *.mcdx file so you do not loose the file.

Step 2) In windows explorer change view | show | file extensions if not already set

Step 3) Change the file extension from *.mcdx to *.zip

Step 4) Unzip this now archive file

You now have a collection of subdirectory and xml files.

 To go back after making any changes: is to zip the subdirectories and change the extension back to *.mcdx.

 

Cheers

Terry

 

 

thank you so much it works 

Teery, 

Can this process be automatically?. Like I write a program in the sheet itself and when I'm done it generate xml file and export it to a certain location

Regards

Yusra

Hi,

To do this you would need to automate windows to change the file extension and automate the saving of the xml files.

Prime programming using Prime statements within the Prime worksheet itself this is not possible.

 

Cheers

Terry

 

.

 

I did what you suggested but the worksheet file does not WORK. other files work . why do you think that happens?

YA_10963798_0-1718988342141.png

 

LucMeekes
23-Emerald III
(To:YA_10963798)

The error message you show is clearly not from Prime.

What worked yesterday (ref: "thank you so much it works") and what does "not WORK" today while "other files work"?

What did you expect to get out of the .xml worksheet file?

 

Success!
Luc

Hi Luc, 

Sorry for the late reply. 

What works is the way you showed me to convert the sheet into xml files.

What doesn't work is only one file ( named as worksheet) please check the image. all the other files open and have data on. 

YA_10963798_0-1719243178271.png

 

LucMeekes
23-Emerald III
(To:YA_10963798)

The .mcdx file usually contains the calculation results, but not in the worksheet.xml subfile.

If you need the results mfor further processing you better write them from within Prime to an Excel workbook ( you can use WRITEEXCEL ) or to a comma separated file ( .CSV file use WRITECSV ).

Look these functions up in the help to understand how they work. Come back here with your Prime worksheet ( .mcdx) file attached if you run into problems.

 

Success!

Luc

ok thank you for that information, I tried but this error occurs 

YA_10963798_0-1719427270644.png

 

You have to strip the units (divide by them) as Excel can't deal with units.

 

You can't export a nested array - how should Excel arrange the data in its 2D spreadsheet?

You have a 6x1^matrix containing 23x1 matrixes. You may create a 6 x 23 matrix or a 23 x 6 matrix from your data, strip the units and then export it to Excel.

 

Strange enough is that your quantities are of unit square of Pascal!? Not sure how you managed to create that data structure!? I tried and I could not create it in a way the Pa would be shown for each vector and also at the end.

 

Anyway, you could try something like

Werner_E_0-1719431371836.png

which creates a simple 23 x 6 data matrix of unit-less scalars which then could be exported to Excel.

Just out of curiosity - what would you use these exported XML files for?

Hi Werner, 

I hope you are doing well. 

Well, after we do the clacultions in mathcad I have to have them as xml file so my co- worker Ahmed can use them in C# programming and Revit to design the constructions and verify the results. 

Is there any why that mathcad work alongside with C#. I read the user guide (

Example 2: MS Dev Studio C# WPF) Honsetly I didn't understand;(

It can also work  also, if I get the results in excel sheet. Is there a way to that?

So, as I understand now, all you want is to export some numerical results derived with Prime calculations in a format which could be read in by third party software, maybe a C# program?

XML is on open format and there is no standard for mathematical results. Furthermore the method described by Terry gives you the whole Prime sheet in a proprietary coded XML file(s). Seems not to be what you need.
You may either write a Prime program to write the data to an external XML file in a format and with tags you first would have to agree upon with your colleague. Quite some work and too much hassle, I guess.
Of course your colleague also could write a parser in C# which can extract the necessary data from the XML file (usually "result.xml") created by Terrys suggestion. But I would consider this far too much hassle , too.

 

Why not just export the data in a standard format like a CSV file? You can do this with the WRITECSV function and it should be not too difficult to read in the data with a C# program.

You also can export the data in an Excel sheet using the WRITEEXCEL function if this is preferred.
Lookup the section about reading and writing files in the help

About Functions for Reading and Writing Files

especially

CSV Data Files

Excel Data Files

If you experience problems exporting your data, come back, open a  new thread, ask your question and don't forget to attach your file and state which version of Prime you are using.

Thank you Werner , 

I will try these solutions 

 

Top Tags