inor0627 wrote

> Hello,

>

> I tried to read a text file (complex.txt) containing complex numbers:

> 0; 3+4i; 22

>

> the commands:

> format free;

> dlmread('complex.txt',';')'

> result in:

> ans =

> (0,-0)

> (3,-4)

> (22,-0)

>

> All number are converted to complex numbers, that's okay for me. But why

> is

> the sign of the imaginary part of 3+4i inverted?[...]

Dear Ingo,

This behavior is very expected, but fools me (this time again) often as

well. The '-Operator is the complex conjugate transposition [1].

Thus

dlmread('complex.txt',';')

ans =

(0,0) (3,4) (22,0)

and then of course:

dlmread('complex.txt',';')'

ans =

(0,-0)

(3,-4)

(22,-0)

I think you want this:

dlmread('complex.txt',';').'

ans =

(0,0)

(3,4)

(22,0)

HTH,

Kai

[1]

https://www.gnu.org/software/octave/doc/interpreter/Arithmetic-Ops.html--

Sent from:

http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html_______________________________________________

Help-octave mailing list

[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave