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

80 ビュー (過去 30 日間)
huachuca
huachuca 2024 年 12 月 30 日
編集済み: huachuca 2024 年 12 月 31 日
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 件のコメント
Cris LaPierre
Cris LaPierre 2024 年 12 月 31 日
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 2024 年 12 月 31 日
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

サインインしてコメントする。

採用された回答

Cris LaPierre
Cris LaPierre 2024 年 12 月 31 日
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 件のコメント
huachuca
huachuca 2024 年 12 月 31 日
編集済み: huachuca 2024 年 12 月 31 日
Thanks this works. As an alternative I used ConvertIQ_13 from R&S to convert the file to ASCII format and went from there.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by