简体   繁体   中英

How to save a matrix of complex entries in Octave / Matlab?

I have a FFT output as a matrix with complex numbers, and all the results I have found online about saving the matrix as a file to be used later on include some ad hoc loops, and discuss how the imaginary part is otherwise disregarded.

I wonder if there is an easier way.

As a toy example:

M = rand(3,3) + 1i * rand(3,3)

M =

 (0.159968,0.713216) (0.143438,0.379509) (0.636987,0.561565)
 (0.386119,0.723281) (0.720302,0.353988) (0.87171,0.445676)
 (0.536274,0.399646) (0.149597,0.574987) (0.358984,0.110503)

The answer in here :

M = rand(3,3) + 1i * rand(3,3)

dlmwrite('M.txt', M)

fails to preserve columns and rows.

I guess this is the answer :

M = rand(3,3) + 1i * rand(3,3)

dlmwrite('M.txt', M)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM