MATLAB Answers


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.

Asked by pulkit singh on 26 Jun 2019
Latest activity Commented on by pulkit singh on 2 Jul 2019
Accepted Answer by Jan
% 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);
inPhaseOsc = 1/sqrt(2)*cos(2*pi*Fc*evenTime);
quadPhaseOsc = 1/sqrt(2)*sin(2*pi*Fc*oddTime);
qpskModulated = oddNrzData.*quadPhaseOsc + evenNrzData.*inPhaseOsc;
inPhaseOsc = inPhaseOsc';
quadPhaseOsc = quadPhaseOsc';
% i want above two matrix in a tab delimed .txt file in two columns saperated by TAB.

  1 Comment

What is the relation between the question and the code?

Sign in to comment.

1 Answer

Answer by Jan
on 26 Jun 2019
 Accepted Answer

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);


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?

Sign in to comment.