How to save a double number to integer to a .txt file?

Hi, I got some double type numbers in Matlab, I want to change them to int type,and save the int type numbers on a .txt file. Can someone tell me how to do it?

Answers (2)

I have solved the problem. First,change the double type number to int32 type, and then use function fprintf() to save the variables to .txt file.
Hi Susan,
you don't have to convert to int. Just round and use save with "-ascii".
Titus

Asked:

on 28 May 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!