Skip to main content
1-Visitor
August 29, 2020
Solved

Exporting table from Mathcad

  • August 29, 2020
  • 3 replies
  • 6284 views

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?

    Best answer by Werner_E

    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.

     

    3 replies

    25-Diamond I
    August 29, 2020

    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_U1-VisitorAuthor
    1-Visitor
    August 31, 2020

    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

     

     

    25-Diamond I
    August 31, 2020

    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.

     

    23-Emerald I
    August 31, 2020

     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?

    M_U1-VisitorAuthor
    1-Visitor
    August 31, 2020

    Hello,

     

    the same error in notepad.

     

     

    23-Emerald I
    August 31, 2020

    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_E25-Diamond IAnswer
    25-Diamond I
    August 31, 2020

    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_U1-VisitorAuthor
    1-Visitor
    August 31, 2020

    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.