MATLAB Answers

Error while using writematrix to save complex values in a .txt

12 views (last 30 days)
Ragini Bakshi
Ragini Bakshi on 4 Dec 2019
Edited: Jeremy on 26 May 2021
Hello, I have a very basic script that reads in around 15000 complex values from a .csv file, does some basic data manipulation and saves it into a .txt file using writematrix. However, it seems the values with a negative imaginary component (i.e. in the form of a-bi) are being saved into the .txt as a+-bi. Calling a readmatrix on this file saves these values as NaN and I cannot proceed. Any ideas? A segment of the code follows along with the exported file values.
%% 1. .csv file to table to array
%% 2-4: Modify values by basic division, rss, etc
%% 5. Export data
writematrix(signal_d_prime, 'signal_modified.txt', 'Delimiter', ' ')
%% Check
signal mod.JPG

Accepted Answer

Jeremy on 4 Dec 2019
Edited: Jeremy on 4 Dec 2019
Does this correctly. I will look into writematrix
Jeremy on 26 May 2021
What version of MATLAB are you using? The issue with writematrix described in this post was fixed in R2020b. If you are using an older version I would recommend updating. If you are using a recent version and still running into an issue I would recommend making a separate question post.

Sign in to comment.

More Answers (0)




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!