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

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 Comments

Related: https://www.mathworks.com/matlabcentral/fileexchange/5296-rohde-schwarz-fsp-spectrum-analyzers for communicating "live" with Rohde & Schwarz® FSP series of spectrum analyzers. But that FEX contribution was created a long time ago and might no longer be compatible..
Thanks for telling me. I happen to have the proper tool boxes for instrument communication, and unfortunately they aren't capable of creating .wv files unless I am wrong. I can creatie my own IQ/complex values and all for a specified waveform, however, I need to save as .wv including the metadata which is required to upload to R&S signal generator.
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.
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

Sign in to comment.

 Accepted Answer

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 Comment

huachuca
huachuca on 31 Dec 2024
Edited: huachuca on 31 Dec 2024
Thanks this works. As an alternative I used ConvertIQ_13 from R&S to convert the file to ASCII format and went from there.

Sign in to comment.

More Answers (0)

Asked:

on 30 Dec 2024

Edited:

on 31 Dec 2024

Community Treasure Hunt

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

Start Hunting!