Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: reading complex marix from file
Date: Fri, 14 Nov 2008 15:33:02 +0000 (UTC)
Organization: Pierburg GmbH
Lines: 38
Message-ID: <gfk5ne$hti$1@fred.mathworks.com>
References: <lK1Tk.7$V71.3@newsfe10.iad> <5212991.1226646349925.JavaMail.jakarta@nitrogen.mathforum.org>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1226676782 18354 172.30.248.35 (14 Nov 2008 15:33:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 14 Nov 2008 15:33:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 872224
Xref: news.mathworks.com comp.soft-sys.matlab:500849


G0Y <gbencedi@gmail.com> wrote in message <5212991.1226646349925.JavaMail.jakarta@nitrogen.mathforum.org>...
> Actually the contets of my vector.txt file (one cloumns from the 1000):
> 
>  0.998697+0i 
>  0+0i 
>  0.0510287+0i 
>  0+0i 
>  0+0i 
>  0+0i 
>  0+0i 
>  0+0i 
> 
> I would like to read in with fscanf or other way if it is possible.
> 
> >> fin = fopen('vector.txt', 'r');
> 
> >>> A = fscanf(fin,'I do not know this part...' ,[4,2]);
> 
> 
> Message was edited by: G0Y

Hi,
did you consider Walter's reply?

c = sscanf('1+2i 3-4.5i -6.7+8i','%f %fi')

c =

    1.0000
    2.0000
    3.0000
   -4.5000
   -6.7000
    8.0000

That's just what you want, isn't it?
Hth
Andres