Error Uploading .GEV File Type into MATLAB
조회 수: 6 (최근 30일)
이전 댓글 표시
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
Elliott
2023년 6월 30일
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
2023년 11월 30일
편집: Walter Roberson
2024년 8월 16일
If you know the binary structure of the GEV files, you can always create your own parser.
답변 (1개)
Rushikesh
2024년 8월 16일
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.
댓글 수: 0
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!