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)
% 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.

Accepted Answer

Jan
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);
  2 Comments
pulkit singh
pulkit singh on 2 Jul 2019
HI,
I transmitted my QPSK signals into a text file with you help. Thank you vry much.
Can you also help me to read these Tab delimited data file and store two columns data into two different variables?
thanks

Sign in to comment.

More Answers (0)

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!