Error Uploading .GEV File Type into MATLAB

5 visualizaciones (últimos 30 días)
Karlynn McCarthy
Karlynn McCarthy el 3 de Feb. de 2022
Editada: Walter Roberson el 16 de Ag. de 2024
Hello,
I have been performing hardware testing that stores my torque and current data in .GEV files. I was unsure how to access the data and found that GelEval was able to convert the data into Excel sheets. Unfortuenly, the time it takes to convert each .GEV file to .xlsx is immense. I am looking for a way to upload the data directly into Matlab from the .GEV file. Is there a way to upload an uncommon data file? I have tried to upload the data using 'import data' but the files disapear in the browser. Additionally, I have tried to covert the .GEV file using Matlab, but have been unsuccesful. Please let me know if you have had experience with .GEV files or have advice on accessing uncommon data files. Thank you!
  2 comentarios
Elliott
Elliott el 30 de Jun. de 2023
Did you ever end up figuring this out I am running into the exact same problem and its looking like I may have to convert several hundred .GEV files? Did there turn out to be a better way?
Taylor
Taylor el 30 de Nov. de 2023
Editada: Walter Roberson el 16 de Ag. de 2024
If you know the binary structure of the GEV files, you can always create your own parser.

Iniciar sesión para comentar.

Respuestas (1)

Rushikesh
Rushikesh el 16 de Ag. de 2024
I understand that you want to convert GEV file into XLSX file. Since GEV file extension is limited to GelEval tool and it is not widely recognized, without specific details about GEV file format, it is challenging to get precise solution.
However you can use custom parsing as mentioned by Taylor. I am assuming GEV file format is like below sample file
You can create a custom parser in MATLAB that would convert GEV file to CSV file (for example) using MATLAB File I/O functions. Sample code is given below
inputFileName = 'sample.gev';
outputFileName = 'output.csv';
% Open the .gev file for reading
fileID = fopen(inputFileName, 'r');
% Initialize variables to store data
data = [];
header = {};
% Read the file line by line
while ~feof(fileID)
line = fgetl(fileID);
% Skip empty lines or comments
if isempty(line) || startsWith(line, '#')
continue;
end
% Process the data section
if startsWith(line, '[Data]')
% Read the header line
headerLine = fgetl(fileID);
header = strsplit(strtrim(headerLine), ' ');
% Read the data lines
while ~feof(fileID)
line = fgetl(fileID);
if isempty(line)
continue;
end
% Split the line into individual values
values = str2double(strsplit(strtrim(line), ' '));
data = [data; values]; %#ok<AGROW>
end
end
end
fclose(fileID);
% Write the data to a CSV file
csvwrite(outputFileName, data);
% Add the header to the CSV file
fid = fopen(outputFileName, 'w');
fprintf(fid, '%s,%s,%s\n', header{:});
fclose(fid);
dlmwrite(outputFileName, data, '-append');
I have tested above code in MATLAB R2024a and it is producing appropriate CSV file.
I hope this helps.

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by