ASCII to Decimal numbers
3 views (last 30 days)
Show older comments
Adelaide Bradicich
on 20 Aug 2018
Commented: Star Strider
on 20 Aug 2018
I have an instrument that outputs ascii instead of decimal numbers. How do you convert between the two formats? I've attached a text file of the data I'm dealing with. It's supposed to be packed as 4-byte single precision floating point binary, in little endian format. I'm new to data types, so if someone could also tell me what exactly that means it would be greatly appreciated! Thanks in advance for your help.
0 Comments
Accepted Answer
Star Strider
on 20 Aug 2018
Try this, to see if it looks like the result you expect:
fidi = fopen('ascii_data.txt','r');
D = fread(fidi, 'single', 'ieee-le');
fclose(fidi);
figure
plot(D)
grid
This should get you started, and you will likely have to experiment to get the result you want.
I have no recent experience with these sorts of files, and when I was working with them quite a while ago, knew the result to expect.
2 Comments
More Answers (0)
See Also
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!