The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Edit xml File with fopen and fprintf
Replies: 4   Last Post: Dec 25, 2012 11:32 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Avri Alony

Posts: 40
Registered: 1/22/11
Edit xml File with fopen and fprintf
Posted: Dec 25, 2012 4:57 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I have xml file with few strings rows
I used fopen to open the original file, fopen('w') to open new file and fprintf to print all line from original file to new file as one can see below.

The problem is that when I open the new file with notepad I get messy text, instead of rows I get long text with spaces
when I open it with notepad++ then the text is organize by rows exactly as in the original file.

Which function I shall use in order to get exactly the same text structure?

Function Code:

FidOldFile = fopen([PathName,'\',FileName]);
FidNewFile = fopen([PathName,'\',NewFileName],'w');
tline = fgetl(FidOldFile);
while ischar(tline)
tline = fgetl(FidOldFile);

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.