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:
open txt file in notepad same format with m-editor

Subject: open txt file in notepad same format with m-editor

From: wahyoe Unggul

Date: 2 Apr, 2011 12:02:04

Message: 1 of 3

P=('Example : Matlab to Text')
B=mat2str(['OR' ' AND ' 'FOR'])
A=rand(3)
AZ='example1.txt'
fid=fopen(AZ,'w')
 fprintf(fid, '%15s\n',P) ;
 fprintf(fid, '%15s\n \n',(B));
 fprintf(fid, '%5.0f %5.0f %5.0f\n',P') ;
fclose(fid) ;

if opened using M-editor, then the result is like this
Example : Matlab to Text
  OR AND FOR
  69 120 97
  109 112 108
  101 32 58
   32 77 97
  116 108 97
   98 32 116
  111 32 84
  101 120 116

if opened using NOTEPAD, then the result is like this
Example : Matlab to Text OR AND FOR 69 120 97 109 112 108

I want to ask, how so that if in open txt file in notepad same format with m-editor?
thanks
wahyoe

Subject: open txt file in notepad same format with m-editor

From: ImageAnalyst

Date: 2 Apr, 2011 14:01:23

Message: 2 of 3

Try writing out with \n\r or \r\n - one of them should work (I can
never remember which is the right one).

Subject: open txt file in notepad same format with m-editor

From: wahyoe Unggul

Date: 2 Apr, 2011 14:13:02

Message: 3 of 3

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <c4d6bf58-dcfd-46c5-9507-0216b0e661d7@k22g2000yqh.googlegroups.com>...
> Try writing out with \n\r or \r\n - one of them should work (I can
> never remember which is the right one).

\r\n
image, thank you very much

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