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

New to MATLAB?

Thread Subject:
writing data to txt file.

Subject: writing data to txt file.

From: Raady

Date: 23 Mar, 2011 12:47:04

Message: 1 of 3


I have a variable that contains n rows and 8 columns of data , which i am trying to export to a text file.

a sample of first row of 'zrd' matrix looks like
12 -4.3 1.204e02 'moving.avi' 'testfile' 33 43 0 [44.26,32.2]

i want this to be saved to a text file .
i want to add header to this file as well
time signleft signright Stimuliname filename tag tag event regressiondata.

Any suggestions would be helpful .


I tried some code but doesn't work.
fid = fopen('newfile1.txt','w');
fwrite(fid, 'zrd');

 I get the following error
??? Error using ==> fwrite
Cannot write value: unsupported class cell.

if i write using save function

if i open i see this in text file -->

MATLAB 5.0 MAT-file, Platform: PCWIN, Created on: Wed Mar 23 12:50:27 2011 IM " xœœÙ}dUqðsîËî®iÍRŠô&“(Ko’T’Rd’LF{»îfÕdMJ‘$™D‰TRI’R$I&Q"+É$I)&I&Q¢×sê–ëjäsxœßóx>_çü{Ne§Ò
aYt/* ~_éBŸ(T<ÏDÕ•Ë·6mi....huge data like this.

Subject: writing data to txt file.

From: Miroslav Balda

Date: 23 Mar, 2011 21:09:04

Message: 2 of 3


help fprintf

Subject: writing data to txt file.

From: Raady

Date: 1 Apr, 2011 23:31:04

Message: 3 of 3

I found a program which is very useful , check out !

Tags for 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