getting different results for subtraction
Show older comments
I'm new to matlab , and caught at a point where i can't understand things. actually i have 2 files, one binary file and one csv file. I'm writting data as float in c++ in vitis hls in that binary file and i'm writting data as float32 in jupyter lab in python and uploaded these files to matlab and attempt to get difference but, i am getting diff results when i check the difference values again n again and my matlab code is below:
clc, clear all;
beamformed_data = readmatrix('delay1024.csv');
filename = 'dec15_CFB_hls_ver2.bin';
fid = fopen(filename,'rb');
if fid == -1
error('Error opening file');
end
% Read the binary data into a 1D array
%data = fread(fid, inf, 'float');
data = fread(fid,'float');
% Reshape the 1D array into a 2D array
beamformed_data2 = reshape(data, 1024, 33);
difference = (beamformed_data2 - beamformed_data) ;
can i be guided somehow?
1 Comment
Steven Lord
on 17 Dec 2024
Please attach your delay1024.csv and dec15_CFB_hls_ver2.bin files.
Also please describe the magnitude of values you're seeing in the difference variable. Are the differences large or are they on the order of roundoff error (eps(beamformed_data))?
Answers (0)
Categories
Find more on Call Python from MATLAB 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!