MATLAB Answers

What code is it?

2 views (last 30 days)
Paul Hardy
Paul Hardy on 20 Oct 2020
Commented: Paul Hardy on 23 Oct 2020
Is there someone recognize the following code and how to convert it to the normal data?
===================================================
MATLAB 5.0 MAT-file, Platform: PCWIN64, Created on: Wed Oct 14 17:38:35 2020 _
IM Ù xœ-бKBQÇñojÖb ¦¯×Ú¡A„à
nWG—2x8ê  ‚ƒ-­MŽnºô'4‰[¸æ_Ðà ›¿wž.ç~îsϹ@岊çÚ’uz´R¼YÌð
¢¼Î[í Bîiq†cEÄ¥üÎZ•/Ô(Êw<˜¿Ù™oب²ã•9%Ù£gîò¨sH›”ù“½ÙãKï:Us%W¨›?ÈáËOü‘–7ÊûÖÏØ<UkyAÕÜ×±oùUÆ1ãßÜÐ}ì&y¤c,ÍC~4y2OÙþå ÝÜ(6 G xœãc``¨ b6 æ bA`d`aÈOÊ2ѾÎþÁ º,³8‘(灤žªžÊgë…`(_¼˄$ > ÆŽ ú xœ-ÒKH”QÆñÿ0ŸYd†±‹×Ô.d}S‹¦¤¢LjÓÅZË‚.ÒUpEáÒœŠr´B0)\ˆÝ Ê¢(‰ ¢‚À¨˜`ê9O3pæ=¿ùÎœó¾ïwJ¶$LSœ®ñÿSTpBã|"Ĉ®#‡——ÉUZ‚%Äâb†§¬µ#ÖÙùÍby&73ì`Àî#Ç"¹š”ÝËJ;ÍCŘ÷t°PþÁ6»ˆFé
¯õkÌõdƒô‡ÝÖVƨ—Çy§U1m|bÜÎ^{ŒÙvÄWäbÍë4*9n/£‡Zù³ì^P#gÔ¾1]¬°Ø`繪¼341¥}cÎé_ÁƒÅAwUšoÑÙAͪ#8¯Á%”Ú÷y£Â^#Ê#ÃY.Ù)Øi6Ú•Z|’ŸÊ1f’GÌ—'¢ õì·¦ô]ë®ç™'—h·¹žÓöˆº]í.æ˜+ßc§ÓiÁ}éœX½þÀy©ž?§Ó>E¿²ˆy«,*äU¬±Û¹a_æ—2ˆõ¶Ú3xl_ Õîà–Ý£ú*\mÖnT‚;¹f?)ø#wì4«íW<³[ØdïỽK7 8I™óɪÁŸù&‚†è¶êô<¸_½îV/ƒ'Øîj›ùk§tû‚Ç5ՏrÌÝjâ¨ÝJ¹»»™Ûv/Ãö¾ÙÃìóÛx©Û ÿ ¯™‹ û xœ-Î1K‚QÆñ¿ùNAÔ`”ºT–Ý”JÒ›$¨!jhkª% šÃ‘‚D-B[»›PŸ ›„†š¤hqÈ¡ç=yáÞs÷árÎ(p€Õ¶ÇÿX5«çŋĘîNgÌá(Ðcš‹Ä™—ÃL‘· êÅq¬Äw›!äqöyR‰ã€K³ã„κç«ÌËR–KtX±ß?æOîY•KL2#÷¸bMî°aÎqHJÞåÄ\Q·uy–k³Ç›r™ªù‹_Òò
Oæ0¯lÉ1žÍqî4‹SÏ7sSåäG>ÌQÞÙ‘[|›‹ì“—»šÌ÷

  0 Comments

Sign in to comment.

Answers (2)

Stephen Cobeldick
Stephen Cobeldick on 20 Oct 2020
Edited: Stephen Cobeldick on 20 Oct 2020
"Is there someone recognize the following code..."
It isn't code, it is a binary .mat file (just as the text at the start of the file clearly states).
"... and how to convert it to the normal data?"
The recommended way it to load into an output variable (which is a structure):
S = load('name_of_the_file.mat');
and then access the fields of that structure. Or during development (i.e. from the command line) you can also use the command-syntax:
load name_of_the_file.mat

  11 Comments

Show 8 older comments
Walter Roberson
Walter Roberson on 22 Oct 2020
No! You cannot get useful data from a mat file using fread. You need to load() it or use matFile()
Stephen Cobeldick
Stephen Cobeldick on 22 Oct 2020
"Would A give me the converted data?"
The literal answer is "yes", it will "convert" the contents of some random binary file (interpreted as uint16) into some most likely very meaningless values. Unlikely to be very useful, but nothing is stopping you from trying.
I suspect that the real problem started with how the data was saved. I have no idea what special types/data encoding/... the Instrument Control Toolbox uses, but that would be where I would start looking.
Paul Hardy
Paul Hardy on 23 Oct 2020
Thanks for the comments!
@ Stephen: according to the instrument manual, the data is stored in the instrument buffer automatically when I ask the instrument to start capture the data. The data is saved as a binary block with little endian sequence of 32 bits (4bytes) single precision floating point format.
What I did more precise is, I ask the instrument to start capture the data and call the data back from the instrument buffer using the following instruction:
data_1 = query(obj1,'CAPTUREGET? 0, 32')
This instruction will retrieve the 32 kbytes data with 0 kbytes offset from the instrument buffer. However, the data_1 is binary (block?) data, as I showed you at the beginning of my question, that I need to convert to a format that we can read normally.
If you have any ideas how to solve it, please let me know.
Thanks in advance!

Sign in to comment.


Walter Roberson
Walter Roberson on 20 Oct 2020
That is not code. That is a .mat file created on a Windows system about a week ago.
Possibly someone accidentally did a save naming a .m file.
The code is gone, replaced with variables. There is no way to get the code back from this file.
You have to hope that there is a backup for the file. Look to see if you have any .asv (autosave) files.

  2 Comments

Paul Hardy
Paul Hardy on 20 Oct 2020
Thanks Walter for the comments!
I got this data from the instrument that I controlled using Matlab and I need to convert this data such that I can get the data in a 'normal' way
Walter Roberson
Walter Roberson on 20 Oct 2020
load() the file

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!