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

Append binary files in Mathcad

CatherineWillia
1-Newbie

Append binary files in Mathcad

Hi all,

Is it possible to append binary files of different format together in Mathcad 15? I would need this to generate a new file format.

Thanks,

Catherine

17 REPLIES 17

Hello!

Please provide an example.

I need to generate a file consisting of a mixture of integers and doubles. The file is defined by first n integers followed by m doubles. Writebin() only allows to create a file of a specific format, either integer or doubles. So I thought of making two separate binary files and then appending them together.

I would have thought this can be achieved. Please provide the files and an example of the required output format.

Mike

Hi Mike,

According to its definition, the function Writebin() allows you to write a binary file of a certain data format uint16, float etc... which you have to specify. In my case, I'm interested in generating a file that contains different formats and I cannot figure out how to do so in mathcad.

Without seeing exactly what your after it's difficult to predict if it can be done. Could you provide the data and example of the file with the formats in? Even if you have to manually type them.

Mike

The example is a binary file containing 9 integers followed by 2059 doubles. In the mathcad file, I create separately the integer and double part but I would still need to merge the generated Integers and Double.zbf files.

Sorry Catherine, I cannot open the *.zbf file.

Mike

Mike;

You can read this file in mathcad using READBIN. Defining the type as "Double" will give you a different vector size and value set than defining is as "uint32".

This highlights the problem. If I were reading this file in Mathcad I could read it twice, once as unsigned integers to get the first nine values, then as double (with the appropriate skips at the front) to get the doubles. But Catherine wants to write this file. I don't know how to write a combination binary file; we'd need and APPENDBIN command.

You can read this file in mathcad using READBIN. Defining the type as "Double" will give you a different vector size and value set than defining is as "uint32".

Oh, I see now. Cheers Fred I have never used that function before.

This highlights the problem. If I were reading this file in Mathcad I could read it twice, once as unsigned integers to get the first nine values, then as double (with the appropriate skips at the front) to get the doubles. But Catherine wants to write this file. I don't know how to write a combination binary file; we'd need and APPENDBIN command.

There doesn't seem to be a way to write a combination binary file in Mathcad, but is there one in Excel?

Mike

Mike Armstrong wrote:

There doesn't seem to be a way to write a combination binary file in Mathcad, but is there one in Excel?

Mike

I don't thinl EXCEL knows anything about binary files--trying to open these files (try example.zbf) with EXCEL is an exercise in frustration.

The best shot at this is probably in MATLAB. (Sorry, I'll go wash my mouth out with soap now.)

Indeed I fear I cannot use mathcad in that case. Anyway thanks for your feedback.

Sorry we couldn't be more assistance.

Mike

But we, as Mathcad beta testers, can make a suggestion for a future release of Mathcad Prime 2.0 to create the necessary function (in this case for data writing).

Yes I agree, but it might be a few versions before we get it

Mike

Agree.

Better late, than never .

The best shot at this is probably in MATLAB. (Sorry, I'll go wash my mouth out with soap now.)

Cheers Fred, don't worry I won't say anything.

Mike

Here are some notes about this format (".zbf"): http://www.ehow.com/facts_6776865_file-extension-_zbf_.html

Announcements
Check out the latest
Mathcad Tip
"PTC Mathcad 15 / Prime 1-6 Update."