convert two columns( one real number and the other is imaginary but without (i) symbol) in txt file to complex number and one column.

3 views (last 30 days)
Hello, I have two columns in a (txt file or xls file I have both) one represent the real part of a complex number and the other represent the imaganary part( without symbol (i)) of the complex number. I want to make one column and each cell in that column countain a complex number by adding the two columns with the considration there is no (i) symble in the imaganary number so we should add it and represent it as imaganary part.

Accepted Answer

Star Strider
Star Strider on 14 Mar 2019
Try this:
D = xlsread('New Microsoft Excel Worksheet.xlsx');
Cplx = complex(D(:,1),D(:,2));

More Answers (1)

dpb
dpb on 14 Mar 2019
Use xlsread or what other import functions you care to use to read the data depending on how much of the header info you need, then
c=complex(real_part,imag_part);

Categories

Find more on Data Import from MATLAB 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!