Export data from Transfer Function qraw

Hi, can anyone explain me how to understand data that are give export data function in Qspice.
I identify frequency collum but for Gain and phase not et.


Thanks!

refer to this post
Is there a problem with Export data? - QSPICE - Qorvo Tech Forum

Thanks for your help!
Code to inport csv with complex data and transform to dB and Degree into txt file.
clc;

close all;

clear all;

[csvfile csvpath] = uigetfile(‘*.csv’);

fid = fopen([csvpath csvfile]);

C = textscan(fid, ‘%s’, 1, ‘delimiter’, ‘’);

csv.headers = textscan(char(C{1}),‘%s’,‘delimiter’,‘,’);

csv.headers = csv.headers{1};

str = ‘%f’;

for n = 2: length(csv.headers)

str = [str,‘%f,%f’];

end

csv.rawdata = textscan(fid,str);

fclose(fid);

for n = 1: length(csv.headers)

if n == 1

csv.data{1} = csv.rawdata{1};

else

csv.data{n} = csv.rawdata{(n-1)2} + jcsv.rawdata{(n-1)*2+1};

end

end

% csv.headers and csv.data are pair for complex data format

idxx = 1; % idxx should always be 1 for frequency

idxy = 2; % user select which data to plot with idxy

% Extract frequency and complex data

freq = csv.data{1};

data = csv.data{2:3};

% Ensure frequency and data vectors are of the same length

min_length = min(length(freq), length(data));

freq = freq(1:min_length);

data = data(1:min_length);

% Check if data vectors are not empty

if isempty(freq) || isempty(data)

error(‘Data vectors are empty. Check the CSV file contents.’);

end

% Calculate gain in dB and phase in degrees

gain_dB = 20 * log10(abs(data));

phase_deg = unwrap(angle(data)) * 180 / pi;

% Plot dB and phase in degrees

figure;

subplot(2,1,1);

semilogx(freq, gain_dB);

ylabel({csv.headers{idxy}, ’ (dB)'});

xlabel([csv.headers{idxx}, ’ (Hz)']);

title(['Qspice Export csv (complex format) : ', csvfile], ‘interpreter’, ‘none’);

subplot(2,1,2);

semilogx(freq, phase_deg);

ylabel({csv.headers{idxy}, ’ (degree)'});

xlabel([csv.headers{idxx}, ’ (Hz)']);

% Save data to a text file

output_file = fullfile(csvpath, ‘frequency_gain_phase.txt’);

fileID = fopen(output_file, ‘w’);

if fileID == -1

error(‘Failed to create the file. Check the file path and permissions.’);

end

% Write headers and data to the text file

fprintf(fileID, ‘Frequency (Hz)\tGain (dB)\tPhase (Degrees)\n’); % Write headers

for i = 1:length(freq)

fprintf(fileID, ‘%f\t%f\t%f\n’, freq(i), gain_dB(i), phase_deg(i)); % Write data

end

fclose(fileID);

disp(['Data has been saved to ', output_file]);