Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: dlmwrite
Date: Tue, 9 Sep 2008 15:42:01 +0000 (UTC)
Organization: Helbling Technik Bern AG
Lines: 54
Message-ID: <ga65g9$rlr$1@fred.mathworks.com>
References: <ga4rli$s9v$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1220974921 28347 172.30.248.38 (9 Sep 2008 15:42:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 9 Sep 2008 15:42:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1271984
Xref: news.mathworks.com comp.soft-sys.matlab:489390



Hi!

I just tried your matrix concatenation using simply [A;B], and it seemed to work...

could you provide an example of the "strange" formatting it gives you?

"Jessica " <jyorzinski@ucdavis.edu> wrote in message <ga4rli$s9v$1@fred.mathworks.com>...
> Hi,
> 
> I'm trying to append words onto a preexisting .txt file. For example, my original a.txt file:
> 
> Jo  9
> Tom 10
> Jon 
> Tim 12
> 
> And I want to append these values:
> 
> ntxt={
> 'Henry 34'
> 'Bob 3'
> 'Jim '
> }
> 
> so that it produces:
> 
> Jo  9
> Tom 10
> Jon 
> Tim 12
> Henry 34
> Bob 3
> Jim 
> 
> I have tried the code:
> 
> s=textread(a,'%s', 'delimiter','\n','whitespace','');
> Final=[s;ntxt];
> dlmwrite(fnam,char(Final), 'delimiter', '');
> 
> However, this gives me very strange formating. I need the txt file to have things listed like:
> 
> Jo  9
> Tom 10
> Jon 
> Tim 12
> Henry 34
> Bob 3
> Jim 
> 
> Any suggestions?
> 
> Thanks!