-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcovert_pred_to_bits.m
More file actions
31 lines (26 loc) · 1.01 KB
/
covert_pred_to_bits.m
File metadata and controls
31 lines (26 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
for k = 1:3
% -----------------------
% Load Case_k.mat
% -----------------------
caseFile = sprintf('/home/rapcole12/Documents/RFLLM/dataset/simple/output/Case_%d.mat', k);
file = load(caseFile);
% -----------------------
% Save IQ to pred{k}.bin
% -----------------------
iq = file.iq;
iq = single(iq(:)); % ensure column vector, float32
predIQ = sprintf('/home/rapcole12/Documents/RFLLM/dataset/simple/pred%d.bin', k);
fid = fopen(predIQ, 'wb');
fwrite(fid, [real(iq) imag(iq)].', 'float32'); % interleaved I Q
fclose(fid);
% -----------------------
% Save bits to pred_bits{k}.bin
% -----------------------
bits = file.bits(:); % ensure column vector
bits = uint8(bits ~= 0); % force to 0/1 uint8
predBits = sprintf('/home/rapcole12/Documents/RFLLM/dataset/simple/pred_bits%d.bin', k);
fid = fopen(predBits, 'wb');
fwrite(fid, bits, 'uint8');
fclose(fid);
fprintf("Saved pred%d.bin and pred_bits%d.bin\n", k, k);
end