Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!news2.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!newsfe10.iad.POSTED!7564ea0f!not-for-mail
From: Walter Roberson <roberson@hushmail.com>
Organization: Canada Eat The Cookie Foundation
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
Newsgroups: comp.soft-sys.matlab
Subject: Re: reading complex marix from file
References: <7185560.1226612229256.JavaMail.jakarta@nitrogen.mathforum.org>
In-Reply-To: <7185560.1226612229256.JavaMail.jakarta@nitrogen.mathforum.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 24
Message-ID: <lK1Tk.7$V71.3@newsfe10.iad>
NNTP-Posting-Host: 24.79.146.116
X-Complaints-To: internet.abuse@sjrb.ca
X-Trace: newsfe10.iad 1226614801 24.79.146.116 (Thu, 13 Nov 2008 22:20:01 UTC)
NNTP-Posting-Date: Thu, 13 Nov 2008 22:20:01 UTC
Date: Thu, 13 Nov 2008 16:20:16 -0600
Xref: news.mathworks.com comp.soft-sys.matlab:500722


G0Y wrote:

> How can I load a file, which has complex elements?

> I do the following, but I do not know how to define the "format" part of the fscanf.
> 
>>> fin = fopen('vector.txt', 'r');
>>> A = fscanf(fin,'%f+f%i' ,[8,3]);

> This '%f+%fi' does not work.

Please recheck your code. The code you quoted has a format of
'%f+f%i' (from your code) instead of
'%f+%fi' (from your commentary)

Notice the change in position of the second '%'. That would cause it to look for a
literal '+f' instead of for a literal '+' followed by a number followed by a
literal 'i'.

-- 
.signature note: I am now avoiding replying to unclear or ambiguous postings.
Please review questions before posting them. Be specific. Use examples of what you mean,
of what you don't mean. Specify boundary conditions, and data classes and value
relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?