R&S waveform (.wv) files read and write!

90 visualizzazioni (ultimi 30 giorni)
huachuca
huachuca il 30 Dic 2024 alle 20:55
Modificato: huachuca il 31 Dic 2024 alle 21:04
Hello,
How would I read and create R&S waveform (.wv) files? I am not refering to wav sound files by the way. Thanks.
  4 Commenti
Cris LaPierre
Cris LaPierre il 31 Dic 2024 alle 13:25
Can you share a sample file? You can zip it and attach it to your post using the paperclip icon.
You might find the approach taken in this Answers post helpful. It's a different file type, but I imagine the solution here would look very similar.
Cris LaPierre
Cris LaPierre il 31 Dic 2024 alle 14:45
I wouldn't expect it to work as is. You need to adapt it to your file type. That means using the correct bit order, data type and format of the *.wv file. This page may offer a starting point: https://www.rohde-schwarz.com/us/applications/converting-r-s-i-q-data-files-application-note_56280-35531.html

Accedi per commentare.

Risposta accettata

Cris LaPierre
Cris LaPierre il 31 Dic 2024 alle 19:11
Your file format is definitely different. Rather than being all binary, like the example I linked to, it captures the binary data in the waveform data field. The file format looks like this
It's going to take a mixed approach to extract the data.
Since you haven't provided the file format description, I did a quik look. The waveform data appears to be captured as int16 values stored in little endian format. This code can read the file you have shared.
unzip('BPSK.zip')
% Define the filename
filename = 'BPSK.wv';
% Open the file for reading
fileID = fopen(filename, 'r');
c = 2;
pos(1) = 0;
while ~feof(fileID)
[data, pos(c)] = textscan(fileID,'%s',1,'Delimiter',{'{','}'},'MultipleDelimsAsOne',true);
token = data{1};
switch true
case contains(token,'TYPE')
str = split(token,':');
type = str(2);
case contains(token,'CLOCK')
str = split(token,':');
clock = str2double(str(2));
case contains(token,'LEVEL OFFS')
str = split(token,{':',','});
leveloffs = str2double(str(2:end))';
case contains(token,'WAVEFORM-')
str = split(token,'#');
L = str2double(extract(str{1},digitsPattern))-1;
fseek(fileID,pos(c-1)+length(str{1})+1,'bof');
wv = fread(fileID,[2,L/2],'int16','ieee-le');
wv = wv.*(wv<0)./32768 + wv.*(wv>=0)./32767;
I = wv(1,:);
Q = wv(2,:);
end
c=c+1;
end
fclose(fileID);
t = 0:1/clock:(length(I)-1)/clock;
tiledlayout(2,1)
nexttile
plot(t,I)
nexttile
plot(t,Q)
  1 Commento
huachuca
huachuca il 31 Dic 2024 alle 21:02
Modificato: huachuca il 31 Dic 2024 alle 21:04
Thanks this works. As an alternative I used ConvertIQ_13 from R&S to convert the file to ASCII format and went from there.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Data Import and Analysis in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by