Hi there,
I am trying to create a file of approximately 2048 lines of 16-bit binary, it doesn't matter what the data is, it is just test file. so far, I have come out with this:
x = 0:1:1024;
y = 32767*sin(x);
fid = fopen('data.txt','w');
fprintf(fid, '%5.0d\n', y);
fclose(fid);
but it writes it to the file in the format:
3e+04
I am aware that the data generated using a sine wave like I have, will likely have a decimal point, but is there not a way to round it up to the
nearest whole number and not have it is scientific notation. ie:
-32768 to 32767
As I said if it could be in the format:
0000 0000 0000 0000
that is what I really want. Any help on this would be really helpful, I'm sure it is just a simple thing.
Kind regards
Rob
I am trying to create a file of approximately 2048 lines of 16-bit binary, it doesn't matter what the data is, it is just test file. so far, I have come out with this:
x = 0:1:1024;
y = 32767*sin(x);
fid = fopen('data.txt','w');
fprintf(fid, '%5.0d\n', y);
fclose(fid);
but it writes it to the file in the format:
3e+04
I am aware that the data generated using a sine wave like I have, will likely have a decimal point, but is there not a way to round it up to the
nearest whole number and not have it is scientific notation. ie:
-32768 to 32767
As I said if it could be in the format:
0000 0000 0000 0000
that is what I really want. Any help on this would be really helpful, I'm sure it is just a simple thing.
Kind regards
Rob