Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
dlmwrite - problem with delimiter

Subject: dlmwrite - problem with delimiter

From: Yannos M

Date: 4 Nov, 2012 12:27:08

Message: 1 of 10

Hi,

I try to write matrix M in a .txt file

M = [1 ;2 ;3 ;4; 5]

dlmwrite('myfile.txt', M', 'delimiter', '\t')

The file is written but when I open it with the notepad to see the results I see that:

12345 instead of

1
2
3
4
5

Can anybody help me out with this? I want to see the vector as a column in the txt file.

Thanks

Subject: dlmwrite - problem with delimiter

From: dpb

Date: 4 Nov, 2012 13:11:06

Message: 2 of 10

On 11/4/2012 6:27 AM, Yannos M wrote:
...

> I try to write matrix M in a .txt file
>
> M = [1 ;2 ;3 ;4; 5]
>
> dlmwrite('myfile.txt', M', 'delimiter', '\t')
>
...

> Can anybody help me out with this? I want to see the vector as a column
> in the txt file.

Use newline (\n) instead of \t as delimiter...

--

Subject: dlmwrite - problem with delimiter

From: Yannos M

Date: 4 Nov, 2012 14:05:09

Message: 3 of 10

I tried that...It seems that something wrong is in the settings of the wordpad??? I do the same thing in my other pc and it works.. any ideas?


dpb <none@non.net> wrote in message <k75pfr$d0c$1@speranza.aioe.org>...
> On 11/4/2012 6:27 AM, Yannos M wrote:
> ...
>
> > I try to write matrix M in a .txt file
> >
> > M = [1 ;2 ;3 ;4; 5]
> >
> > dlmwrite('myfile.txt', M', 'delimiter', '\t')
> >
> ...
>
> > Can anybody help me out with this? I want to see the vector as a column
> > in the txt file.
>
> Use newline (\n) instead of \t as delimiter...
>
> --

Subject: dlmwrite - problem with delimiter

From: dpb

Date: 4 Nov, 2012 14:25:30

Message: 4 of 10

On 11/4/2012 8:05 AM, Yannos M wrote:

...[top posting repaired..don't do that; hard follow conversation makes]...


> dpb <none@non.net> wrote in message <k75pfr$d0c$1@speranza.aioe.org>...
>> On 11/4/2012 6:27 AM, Yannos M wrote:
>> ...
>>
...

>> > dlmwrite('myfile.txt', M', 'delimiter', '\t')
>> >
>> ...
>> > Can anybody help me out with this? I want to see the vector as a column
>> > in the txt file.
>>
>> Use newline (\n) instead of \t as delimiter...

> I tried that...It seems that something wrong is in the settings of
> the wordpad??? I do the same thing in my other pc and it works.. any
> ideas?

Looks fine here...blame MS and WordPad.

No knowledge of it, really; never use it. Are you writing on a 'nix
boxen and moving to PC by any chance? Matlab will use system-dependent
\n character(s)...

Guess you can look at the file internals w/ a hex dump tool and see what
is actually being written to see if that is the problem.

--

Subject: dlmwrite - problem with delimiter

From: Yannos M

Date: 4 Nov, 2012 14:51:07

Message: 5 of 10

Is there any possibility that something is wrong with the MATLAB settings??



dpb <none@non.net> wrote in message <k75trd$nqa$1@speranza.aioe.org>...
> On 11/4/2012 8:05 AM, Yannos M wrote:
>
> ...[top posting repaired..don't do that; hard follow conversation makes]...
>
>
> > dpb <none@non.net> wrote in message <k75pfr$d0c$1@speranza.aioe.org>...
> >> On 11/4/2012 6:27 AM, Yannos M wrote:
> >> ...
> >>
> ...
>
> >> > dlmwrite('myfile.txt', M', 'delimiter', '\t')
> >> >
> >> ...
> >> > Can anybody help me out with this? I want to see the vector as a column
> >> > in the txt file.
> >>
> >> Use newline (\n) instead of \t as delimiter...
>
> > I tried that...It seems that something wrong is in the settings of
> > the wordpad??? I do the same thing in my other pc and it works.. any
> > ideas?
>
> Looks fine here...blame MS and WordPad.
>
> No knowledge of it, really; never use it. Are you writing on a 'nix
> boxen and moving to PC by any chance? Matlab will use system-dependent
> \n character(s)...
>
> Guess you can look at the file internals w/ a hex dump tool and see what
> is actually being written to see if that is the problem.
>
> --

Subject: dlmwrite - problem with delimiter

From: Steven_Lord

Date: 5 Nov, 2012 15:08:45

Message: 6 of 10



"Yannos M" <ioannis-mitsos@hotmail.com> wrote in message
news:k75vcr$2b2$1@newscl01ah.mathworks.com...
> Is there any possibility that something is wrong with the MATLAB
> settings??

No. If you open the file in the MATLAB Editor you should see what you
expect. Notepad is notorious for not handling newline characters very well.
I even went so far as to make a backup copy of notepad.exe and replaced it
with a renamed copy of Wordpad on one of my machines after one day when I
got frustrated with it automatically opening files in Notepad.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: dlmwrite - problem with delimiter

From: Yannos M

Date: 5 Nov, 2012 15:14:10

Message: 7 of 10

Steve you are right. Notepad was the problem.

writing the command like this:

dlmwrite('myfile.txt', M, 'delimiter', '\t','newline', 'pc')

overcomes the problems even reading the file with notepad!

Yannos


"Steven_Lord" <slord@mathworks.com> wrote in message <k78kpt$9vs$1@newscl01ah.mathworks.com>...
>
>
> "Yannos M" <ioannis-mitsos@hotmail.com> wrote in message
> news:k75vcr$2b2$1@newscl01ah.mathworks.com...
> > Is there any possibility that something is wrong with the MATLAB
> > settings??
>
> No. If you open the file in the MATLAB Editor you should see what you
> expect. Notepad is notorious for not handling newline characters very well.
> I even went so far as to make a backup copy of notepad.exe and replaced it
> with a renamed copy of Wordpad on one of my machines after one day when I
> got frustrated with it automatically opening files in Notepad.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

Subject: dlmwrite - problem with delimiter

From: dpb

Date: 5 Nov, 2012 15:27:27

Message: 8 of 10

On 11/5/2012 9:14 AM, Yannos M wrote:
> Steve you are right. Notepad was the problem.
>
> writing the command like this:
>
> dlmwrite('myfile.txt', M, 'delimiter', '\t','newline', 'pc')
>
> overcomes the problems even reading the file with notepad!
...

Well, if this was done on a PC (as I asked earlier) then I'd say there
is a problem w/ dlmwrite 'cuz it would indicate that it didn't follow
the platform-specific newline convention. OTOH (as I also asked) if it
was written on a 'nix-style platform and then moved to the PC (as _also_
asked but not responded to as well as insisting on the rudeness of
top-posting so thread is out of order) then it is "operating as
designed" and the problem is operator error/wrong expectations...

--

Subject: dlmwrite - problem with delimiter

From: Yannos M

Date: 5 Nov, 2012 17:29:08

Message: 9 of 10

dpb <none@non.net> wrote in message <k78lqp$829$1@speranza.aioe.org>...
> On 11/5/2012 9:14 AM, Yannos M wrote:
> > Steve you are right. Notepad was the problem.
> >
> > writing the command like this:
> >
> > dlmwrite('myfile.txt', M, 'delimiter', '\t','newline', 'pc')
> >
> > overcomes the problems even reading the file with notepad!
> ...
>
> Well, if this was done on a PC (as I asked earlier) then I'd say there
> is a problem w/ dlmwrite 'cuz it would indicate that it didn't follow
> the platform-specific newline convention. OTOH (as I also asked) if it
> was written on a 'nix-style platform and then moved to the PC (as _also_
> asked but not responded to as well as insisting on the rudeness of
> top-posting so thread is out of order) then it is "operating as
> designed" and the problem is operator error/wrong expectations...
>
> --

Hi,

I'm sorry if I insulted you or if I was rude as you sais but I did not see your second reply. Well thank you for your reply, I honestly did not want to insult you and I honestly appreciate the fact that you spent time to reply to my message and I ensure you this will not happen again. However, before putting fire on someone just consider the possibility that he did not want to insult you, he just did not see a reply on the thread (not the worst thing ever)!

Regards,
Yannos

Subject: dlmwrite - problem with delimiter

From: dpb

Date: 5 Nov, 2012 18:11:32

Message: 10 of 10

On 11/5/2012 11:29 AM, Yannos M wrote:
...

> I'm sorry if I insulted you or if I was rude as you sais but I did not
> see your second reply. Well thank you for your reply, I honestly did not
> want to insult you and I honestly appreciate the fact that you spent
> time to reply to my message and I ensure you this will not happen again.
> However, before putting fire on someone just consider the possibility
> that he did not want to insult you, he just did not see a reply on the
> thread (not the worst thing ever)!

Well, you posted a question in response to the response I made that had
the questions in it w/o answering the questions...

No offense taken (or really intended other than a pointed note), simply
that afaict you only asked the question re: where there might be a fault
but didn't respond to the possible cause implied by the question...

And, we _still_ don't know the answers... :)

--

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us