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?

How can I save matrix to .txt file?

Asked by Teemu

Teemu (view profile)

on 13 Mar 2013

I have numerical matrix size of 64*60 and I like to save it to .txt file. How can I do it as easy as possible? without repeating %d with fprintf?

0 Comments

Teemu

Teemu (view profile)

Products

No products are associated with this question.

1 Answer

Answer by Friedrich

Friedrich (view profile)

on 13 Mar 2013
Edited by Friedrich

Friedrich (view profile)

on 13 Mar 2013
Accepted answer

Hi,

use dlmwrite

 a = rand(64,60);
 dlmwrite('filename.txt',a)

1 Comment

Teemu

Teemu (view profile)

on 13 Mar 2013

Now it's working. Thanks!

Friedrich

Friedrich (view profile)

Contact us