Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross 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
Jul 22, 2005
1
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);
 
Replies continue below

Recommended for you

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