Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Matlab not recognising linebreaks

Status
Not open for further replies.

AlexCrosse

Computer
Joined
Jul 22, 2005
Messages
1
Location
GB
This is probably a silly question but I am going to ask it anyway...

I have written some code that puts out an array to file, however Matlab seems not to be able to recognise the line break command ('\n') hence prints out all the data in one long line rather than as a table. Instead of a new line I get a small box character instead. I think my code is correct and the tab command ('\t') works fine.

I was wondeing whether this was a problem with Matlab or a problem with the OS and in either case how it could be fixed.

I am running Matlab 7 on a windows 2000 machine. The code section is printed below:

shunt_level_data = shunt_level_data.';
filename_out = ['TC1_' date '_shuntlevels_out.txt'];
fid_out = fopen(filename_out,'w');
count = fprintf(fid_out, '%2d\t%2d\t%2d\t%2d\t%2d\t%f\t%f\t%f\n', shunt_level_data);
status = fclose(fid_out);
 
When writing a textfile, adding a 't' to the fopen command might help
Code:
fid_out = fopen(filename_out,'w[b][COLOR=red]t[/color][/b]');
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top