How can I convert .000 and .002 files into files that I can understand and work with MATLAB

13 visualizaciones (últimos 30 días)
Hello everyone,
I'm a studient of Marine Science and I'm new with programming and working with different types of files.
I have pressure and wave data from loggers. The files I've got, have the extension .000 and .002.
For example:
21033018.000
21033018.002
21033020.000
21033020.002
21033022.000
21033022.002
...
When I open those files with Notepad++, Excel or other softwares the content is unredable, that is, the written content is in an incomprehensible "language" with symbols.
I want to know how can I get the readable data. Data that I can read and understand with numbers, so I can work with toolboxes for MATLAB. How can I convert those files in files like .csv or .txt that have the understandable data.
Thanks in advance for your attention,
Guillermo
  6 comentarios
Walter Roberson
Walter Roberson el 11 de Ag. de 2022
If you could execute this and show us the result, it might help us identify the file
fid = fopen('21033018.000', 'r');
f64 = fread(fid, [1 64], '*uint8');
fclose(fid);
fprintf('header as character:\n');
fprintf('%c', f64);
fprintf('\n');
fprintf('\nheader as decimal:\n');
fprintf('%03d ', f64);
fprintf('\n');
fprintf('\nheader as hex:\n');
fprintf('%02x ', f64);
fprintf('\n');

Iniciar sesión para comentar.

Respuestas (1)

Gagan Agarwal
Gagan Agarwal el 7 de Sept. de 2023
Hi Guillermo Carballo Lafuente
You can refer to the sample code snippet below to convert the files into a format that is compatible with MATLAB, allowing you to work with them within the MATLAB environment.
files = dir('*.002');
% Loop through each file
for id = 1:length(files)
% Get the file name (minus the extension)
orig_name = files(id).name;
[~, basename, ext] = fileparts(orig_name);
new_name = [basename '_', ext(2:end) '.txt'];
movefile(orig_name, new_name);
end
The above code snippet converts files with the extension '.002' to '.m' files. Similarly, you can convert files with the extension '.000' and ‘.002’ to any desired format by modifying the 'new_name' variable in the code.
  1 comentario
Walter Roberson
Walter Roberson el 7 de Sept. de 2023
This will not help. @Guillermo Carballo Lafuente tried opening them with a text editor and found them to be unreadable to humans, which indicates that they are binary files. Renaming binary files does not make them any more usable to MATLAB.

Iniciar sesión para comentar.

Categorías

Más información sobre Low-Level File I/O en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by