C (and ergo Matlab) is woefully weak in input/output for complex variables. Should been remedied by TMW from the git-go given Matlab is a computational engine and complex variables are inherent in much of science/engineering. But, that aside, one "trick" you can use if you aren't too particular about the output format is
>> z=complex(rand(3),rand(3))
z =
0.1855 + 0.2663i 0.0469 + 0.9033i 0.9006 + 0.8023i
0.8028 + 0.1542i 0.0428 + 0.7362i 0.7809 + 0.5418i
0.8315 + 0.5255i 0.5429 + 0.9076i 0.8857 + 0.4982i
>>
then
writetable(table(z),'writevariablenames',0)
will give you
>> type table.txt
0.185524409358458+0.0469069782405116i,0.900606398311369+0.266286079870998i,0.903297636775399+0.802283416421606i
0.802798214229172+0.0428008632408867i,0.780920556942062+0.154178330544604i,0.736241861039116+0.541798940411929i
0.831494678986611+0.542863198858789i,0.8856901938773+0.525517402969329i,0.907584220125958+0.498240086285874i
>>
Alternatively, write the loop but explicit format for both real, imaginary parts...
fmt=[repmat('%g\t%gi\t',1,size(z,2)-1) '%g\t%gi\n'];
for i=1:size(z,1)
fprintf(fmt,reshape(reshape([real(z(i,:)),imag(z(i,:))],size(z,2),[]).',1,[]))
end
Alternatively, can simplify the organization expression significantly by just writing the explicit double loop...
Another place where a Fortran idiom is really useful...the implied DO so don't have to write the full explicit second for loop.
I remain amazed TMW has never seen fit to deal with such trivialities in 40+ years... :(