Click here to Skip to main content
12,821,198 members (37,526 online)
Rate this:
Please Sign up or sign in to vote.
See more: Matlab file Text

How can i write to a text file every time start from the next line, for example say i have a text file "test.txt" and i have an iterative code that prints say "hello" what i want is hello to be print on next line every time like this


so far i have used
fid = fopen((ta), 'a');
Loop{ fprintf(fid,'%s\n',word); }

any help is warmly appreciated.
Posted 12-Oct-12 0:50am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

In my opinion your loop never ends... Why? Read more about loops:[^]

If you would like to write the data at the end of existing file, read this:[^]
Sergey Alexandrovich Kryukov 12-Oct-12 14:30pm
He-he, right, a 5. I'm just feel awkward to recommend anything in particular. With this level, I cannot be sure the whole thing makes sense.
Maciej Los 12-Oct-12 14:34pm
;) Yes, it's true ;)
Thank you, Sergey.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170308.1 | Last Updated 12 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100