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

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

Exporting table from Mathcad

M_U
9-Granite
9-Granite

Exporting table from Mathcad

Hello,

 

I have a problem with exported files from mathcad. I have a table and I'm using WRITEPRN. It´s works perfectly but whem I try to open the file in Kaleidagraph, i can´t open the columns correctly. Attached is the example.

Can anyone help me?

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:M_U)

My best guess without seeing your sheet is that you data table in Mathcad contains not scalar data only but one entry maybe is a matrix itself - nested matrix.

If thats true, WRITECSV even with the correct order of the arguments (see: https://community.ptc.com/t5/PTC-Mathcad/Exporting-table-from-Mathcad/m-p/685090/highlight/true#M191612) will fail with "Not supported type" error.

If possible you may consider posting your worksheet for inspection.

 

EDIT: Next (probably better) guess. You don't have a nested matrix, but if I interpret the header correctly, your data table contains non-real numbers with very tiny imaginary parts. This accounts for the extra numbers you see in the created file which are separated by the real part by a comma.

 

So try T:=WRITEPRN(arquivo, Re(forca))

This should give you a text file without any header and without the extra numbers and maybe Kaleidograph is happy with that file.

Otherwise you may try T:=WRITECSV(Re(forca), arquivo) or even WRITEEXCEL.

 

Using WRITEPRN you may also have a look at the system variables PRNPRECISION and PRNCOLWIDTH to have a bit more control over the outcome.

 

View solution in original post

9 REPLIES 9
Werner_E
25-Diamond I
(To:M_U)

Which data format does "Kaleidagraph" expect?

WRITEPRN creates a somewhat proprietary file format, maybe WRITECSV would be a better alternative.

 

BTW, its always better to attach the Mathcad file itself and not just pictures.

M_U
9-Granite
9-Granite
(To:Werner_E)

Hi,

 

Kaleidaghaph supports many types o files, including .txt. I believe that my problem is in the first row where appears:

// Datafile written by Mathcad
// 08/31/20 10:57:09

.MATRIX 0 1 24 7.

 

I tried any ways to open it but i couldn't do it.

 

I tried to use the WRITECSV function to the same matrix, but occurs an error that say "this value must be a string". I don´t understand this because to me, it is a matrix

 

 

Fred_Kohlhepp
23-Emerald I
(To:M_U)

The "concatenate" command is expecting to put two or more strings together, but you don't need it:

Capture forca csv Prime.JPGCapture forca csv notepad.JPG

Werner_E
25-Diamond I
(To:M_U)

Look at the integrated Mathcad help!

The arguments have to be switched  --> WRITECSV(forca, arquivo)

In Prime as seen in Freds screenshot it has to be the other way round

This is a discrepancy in syntax in Mathcad 15. All WRITExxxx commands will expect the path+filename as their first argument, but WRITECSV and WRITEEXCEL (another option you might try) have it differently. Even though its documented in the help its sure not as it should be. In Prime this was fixed and the filename is the first argument of ALL WRITExxxx commands with no exception.

 

Fred_Kohlhepp
23-Emerald I
(To:M_U)

 I have a table and I'm using WRITEPRN. It´s works perfectly but whem I try to open the file in Kaleidagraph, i can´t open the columns correctly.

 

I think your trouble is in Kaleidagraph.  (I don't have version 15, so I can't recreate your table, but when I WRITEPRN a matrix,

Capture forca Prime.JPG

I can open it in Notepad:

Capture force notepad.JPG

or Word:

Capture force word.JPG

or EXCEL and get exactly the same thing.

Looking at your two pictures 

exported file (1).JPGtable.JPG

It looks like there are numbers being created that weren't originally there.

Try opening your prn file with notepad, what do you see?

Hello,

 

the same error in notepad.

 

 

Fred_Kohlhepp
23-Emerald I
(To:M_U)

Truly strange!

 

In Mathcad 15, you can (by right-clicking on the table) select the entire table and copy it.  Can you simply paste that data into Kaliedagraph?

Werner_E
25-Diamond I
(To:M_U)

My best guess without seeing your sheet is that you data table in Mathcad contains not scalar data only but one entry maybe is a matrix itself - nested matrix.

If thats true, WRITECSV even with the correct order of the arguments (see: https://community.ptc.com/t5/PTC-Mathcad/Exporting-table-from-Mathcad/m-p/685090/highlight/true#M191612) will fail with "Not supported type" error.

If possible you may consider posting your worksheet for inspection.

 

EDIT: Next (probably better) guess. You don't have a nested matrix, but if I interpret the header correctly, your data table contains non-real numbers with very tiny imaginary parts. This accounts for the extra numbers you see in the created file which are separated by the real part by a comma.

 

So try T:=WRITEPRN(arquivo, Re(forca))

This should give you a text file without any header and without the extra numbers and maybe Kaleidograph is happy with that file.

Otherwise you may try T:=WRITECSV(Re(forca), arquivo) or even WRITEEXCEL.

 

Using WRITEPRN you may also have a look at the system variables PRNPRECISION and PRNCOLWIDTH to have a bit more control over the outcome.

 

M_U
9-Granite
9-Granite
(To:Werner_E)

Hi,

Your tip with writeprn(....)works. Thank you very much.

I solved the problem clicking with the right button on the matrix and exporting as txt.

Your tip is better because it´s faster.

 

 

 

Announcements

Top Tags