Path: news.mathworks.com!newsfeed-00.mathworks.com!nlpi057.nbdc.sbc.com!prodigy.net!news.glorb.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: <gfk5ne$hti$1@fred.mathworks.com> <22127978.1226688196873.JavaMail.jakarta@nitrogen.mathforum.org>
In-Reply-To: <22127978.1226688196873.JavaMail.jakarta@nitrogen.mathforum.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 23
Message-ID: <q2kTk.1622$V71.1466@newsfe10.iad>
NNTP-Posting-Host: 24.79.146.116
X-Complaints-To: internet.abuse@sjrb.ca
X-Trace: newsfe10.iad 1226689814 24.79.146.116 (Fri, 14 Nov 2008 19:10:14 UTC)
NNTP-Posting-Date: Fri, 14 Nov 2008 19:10:14 UTC
Date: Fri, 14 Nov 2008 13:10:35 -0600
Xref: news.mathworks.com comp.soft-sys.matlab:500886


G0Y wrote:
> Not really.
> 
> Let us clarify: I have a .txt file containing complex numbers in one column. I want to read
> it into a matrix. Anyway as I see there is no chance to fulfill this method :((

You are correct, Matlab does not offer any method to read complex numbers directly
in to a matrix. If that is your requirement, then Sorry, you will have to find a different
programming language.

It is, however, fairly easy to program around the lack if you are willing to use
a temporary variable. Building about Andres' example:

c = sscanf('1+2i 3-4.5i -6.7+8i','%f %fi');  %get some data in

t = reshape(c,2,[]);    %row 1 is real parts, row 2 is complex parts
TheMatrix = reshape(complex(t(1,:),t(2,:)), MatrixWidth, MatrixHeight); %make complex and reshape

-- 
.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)?