<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Writing Binary Strings in Mathcad</title>
    <link>https://www.ptcusercommunity.com/t5/Mathcad/Writing-Binary-Strings/m-p/240995#M93949</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK I see that and indeed it works. But a couple of questions come to mind. I would have thought the written file (in this case WriteStrings.txt) would &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;not&lt;/STRONG&gt;&lt;/SPAN&gt; be human readable. What I mean is when I open the file with text editor I expected to see gibberish but yet the text is perfectly readable. Clearly I don't understand what WRITEBIN does.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The next question is what if my output file needs to have text and numbers. For instance I have a title row, followed by the number of data points in the file followed by the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.JPG" class="jive-image image-1" src="https://community.ptc.com/legacyfs/online/95594_Capture.JPG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;How do I build a vector of mixed data types to write to a binary file?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Nov 2015 22:47:15 GMT</pubDate>
    <dc:creator>astevenson-2</dc:creator>
    <dc:date>2015-11-30T22:47:15Z</dc:date>
    <item>
      <title>Writing Binary Strings</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Writing-Binary-Strings/m-p/240993#M93947</link>
      <description>The help file for WRITEBIN states:WRITEBIN("file", "type", endian, [M]) writes an array of scalars to the binary data file named file. Am I correct in concluding that an array of strings cannot be written to a binary file? How would I write string data to a binary</description>
      <pubDate>Thu, 03 May 2018 14:52:12 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Writing-Binary-Strings/m-p/240993#M93947</guid>
      <dc:creator>astevenson-2</dc:creator>
      <dc:date>2018-05-03T14:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Binary Strings</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Writing-Binary-Strings/m-p/240994#M93948</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use str2vec() function to convert the string(s) to (an) array(s) of ASCII values before applying WRITEBIN(). Be sure to use 'byte' as the type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-1" src="https://community.ptc.com/legacyfs/online/95571_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Success!&lt;/P&gt;&lt;P&gt;Luc&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Nov 2015 22:25:17 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Writing-Binary-Strings/m-p/240994#M93948</guid>
      <dc:creator>LucMeekes</dc:creator>
      <dc:date>2015-11-30T22:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Binary Strings</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Writing-Binary-Strings/m-p/240995#M93949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK I see that and indeed it works. But a couple of questions come to mind. I would have thought the written file (in this case WriteStrings.txt) would &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;not&lt;/STRONG&gt;&lt;/SPAN&gt; be human readable. What I mean is when I open the file with text editor I expected to see gibberish but yet the text is perfectly readable. Clearly I don't understand what WRITEBIN does.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The next question is what if my output file needs to have text and numbers. For instance I have a title row, followed by the number of data points in the file followed by the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.JPG" class="jive-image image-1" src="https://community.ptc.com/legacyfs/online/95594_Capture.JPG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;How do I build a vector of mixed data types to write to a binary file?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Nov 2015 22:47:15 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Writing-Binary-Strings/m-p/240995#M93949</guid>
      <dc:creator>astevenson-2</dc:creator>
      <dc:date>2015-11-30T22:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Binary Strings</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Writing-Binary-Strings/m-p/240996#M93950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, Andy, the file isn't human readable, because it contains binary numbers.&lt;/P&gt;&lt;P&gt;See here:&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="95599" alt="" class="jive-image image-1" src="https://community.ptc.com/legacyfs/online/95599_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;If you open it with NotePad however, that application takes the binary numbers, interprets them as ASCII codes and translates those codes to the characters according the ASCII table.&lt;/P&gt;&lt;P&gt;And applying vec2str() to the result of READBIN&amp;nbsp; as type 'byte', basically does the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to mix text and numbers you first need to decide who (or what application) is going to read/interpret the file, then how you want/need to insert those numbers.&lt;/P&gt;&lt;P&gt;If you want the file to be readable by NotePad, you might want to use the num2str() conversion in Mathcad, followed by the WriteStrings function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If another application or self written program is to read, AND interpret, the file, you might consider mixing the stuff.&lt;/P&gt;&lt;P&gt;In Mathcad 11 there isn't an APPENDBIN() function. I tried to write one, and it partially works as expected. That function should allow to first write out binary data as 'bytes', then a chunk of data as 32 bit floating point values etcetera.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Luc&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Dec 2015 17:26:50 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Writing-Binary-Strings/m-p/240996#M93950</guid>
      <dc:creator>LucMeekes</dc:creator>
      <dc:date>2015-12-01T17:26:50Z</dc:date>
    </item>
  </channel>
</rss>

