i want to export two "100X1 double" matrix into one tab delimited .txt file. file should have two columns with tab delimiter. column one with matrix one and column two with matrix two data.
1 view (last 30 days)
Show older comments
% Demonstration of QPSK Modulation and Demodulation
clear; %clear all stored variables
N=500; %number of data bits
noiseVariance = 0.1; %Noise variance of AWGN channel
Rb=1e3; %bit rate
amplitude=1; % Amplitude of NRZ data
data=randn(1,N)>=0; %Generate uniformly distributed random data
oddBits = data(1:2:end);
evenBits= data(2:2:end);
[evenTime,evenNrzData,Fs]=NRZ_Encoder(evenBits,Rb,amplitude,'Polar');
[oddTime,oddNrzData]=NRZ_Encoder(oddBits,Rb,amplitude,'Polar');
Fc=2*Rb;
inPhaseOsc = 1/sqrt(2)*cos(2*pi*Fc*evenTime);
quadPhaseOsc = 1/sqrt(2)*sin(2*pi*Fc*oddTime);
qpskModulated = oddNrzData.*quadPhaseOsc + evenNrzData.*inPhaseOsc;
Tb=1/Rb;
inPhaseOsc = inPhaseOsc';
quadPhaseOsc = quadPhaseOsc';
% i want above two matrix in a tab delimed .txt file in two columns saperated by TAB.
1 Comment
Accepted Answer
Jan
on 26 Jun 2019
Omit the transposing. Then:
data = [inPhaseOsc; quadPhaseOsc];
[fid, msg] = fopen(FileName, 'w');
assert(fid > 0, 'Cannot open file %s: %s', FileName, msg);
fprintf(fid, '%g\t%g\t\n', data);
fclose(fid);
More Answers (0)
See Also
Categories
Find more on Tables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!