Remove "" from TEXT FILE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Labels:
-
Mathcad Usage
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@terryhendicott wrote:
Hi,
WRITEPRN in Mathcad 15 used to do exactly that but for unknown reasons they changed it for Prime?
WRITEPRN is still available in Prime and works the same way as in MC15 - it does not remove the quote character either and additionally adds some header information at the top.
WRITETEXT is new in Prime and should have been implemented in a way so that at least you have a choice to remove the quotes.
It was a long standing wish for Mathcad to be able to create true text files in an easy and intuitive way but the only way to accomplish that was using the WRITEBIN function.
Here is a brute force workaround - a user defined function WRITETXT2() which uses WRITETXT to write the file, reads it in again via READBIN, removes all quote character (#34) and rewrites the file via WRITEBIN.
Should work well as long as the strings don't contain quote characters themselves!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi,
WRITEPRN in Mathcad 15 used to do exactly that but for unknown reasons they changed it for Prime?
Here is a workaround that does what Mathcad 15 used to produce. It creates a binary file which is nothing but a collection of bytes that can be read by an editor like Notepad. It creates an extra line at the top but you can delete this in the text editor. It generates spaces (character 32) between the items but could be adjusted to do tabs (character 9) in between if required.
Cheers
Terry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@terryhendicott wrote:
Hi,
WRITEPRN in Mathcad 15 used to do exactly that but for unknown reasons they changed it for Prime?
WRITEPRN is still available in Prime and works the same way as in MC15 - it does not remove the quote character either and additionally adds some header information at the top.
WRITETEXT is new in Prime and should have been implemented in a way so that at least you have a choice to remove the quotes.
It was a long standing wish for Mathcad to be able to create true text files in an easy and intuitive way but the only way to accomplish that was using the WRITEBIN function.
Here is a brute force workaround - a user defined function WRITETXT2() which uses WRITETXT to write the file, reads it in again via READBIN, removes all quote character (#34) and rewrites the file via WRITEBIN.
Should work well as long as the strings don't contain quote characters themselves!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@terryhendicott wrote:
Hi,
WRITEPRN in Mathcad 15 used to do exactly that but for unknown reasons they changed it for Prime?
What I meant to say is a data export wizard existed in Mathcad 15 that outputted a formatted text file in PRN format from a matrix.
numbers remained numbers, single quoted text was written as text without quotes, double quoted text was written as single quoted text.
I miss this utility in Prime.
Cheers
Terry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@terryhendicott wrote:
@terryhendicott wrote:
Hi,WRITEPRN in Mathcad 15 used to do exactly that but for unknown reasons they changed it for Prime?
What I meant to say is a data export wizard existed in Mathcad 15 that outputted a formatted text file in PRN format from a matrix.
numbers remained numbers, single quoted text was written as text without quotes, double quoted text was written as single quoted text.
I miss this utility in Prime.
Ah, I see. I think I never used that feature, but I sure miss data-table from that very same menu.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
There is this in the help:
I don't know how to implement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
These "options" are only available for reading with READTEXT( ) to tell Prime what the delimiters of text strings in the (already existing) file ar or if everything should be interpreted as text.
So this won't help you as you'd like to create a file using WRITETXT( ).
So I guess you will have to resort to either Terrys AssemblePRN ( ) or my WRITETXT2 ( ).
WRITETXT2 ( ) can't be used if your textstrings contain the double quotes themselves.
This could be fixed, but would increase the functions size as we would have to look if a quote is either the first or last character in the file or if its followed or prepended by a TAB or CRLF before we can remove it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi,
You could also just use a text editor and replace " with nothing.
Cheers
Terry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
There was a sample worksheet some time ago for converting Mathcad matrices to C++ code. They ran into the same problem with the double quotes and wrote a cool function that converts the matrix strings to binary vectors (using the string to vector function, str2vec) to encode everything as binary arrays and then write the arrays to a file using WRITEBIN(), which writes binary to a file with no formatting (like adding the double quotes).
Here's the User Function (slightly modified from the original) to output the matrix to a text file with no double quotes:
Use the function as follows:
I've attached an update to your sequencer worksheet here that demonstrates this function (in Prime 9 format, since that's what you uploaded).