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:
dlmwrite with different precisions?

Subject: dlmwrite with different precisions?

From: James Ramm

Date: 1 Sep, 2010 11:54:25

Message: 1 of 2

Hi, is it possible to specify some numbers written to file with dlmwrite to have different precisions? For example, imagine I wish to do the following:

dlmwrite ('file',[vector1 vector2 vector3],'Delimiter',' ')

where vector* are different column vectors. I would like to specify vector1 to have %.1f precision and the rest to be integers (or any combinations of precision). How could I achieve that?
Thanks

Subject: dlmwrite with different precisions?

From: Robert Cumming

Date: 1 Sep, 2010 13:07:06

Message: 2 of 2

"James Ramm" <theres_ambrosia_there@hotmail.com> wrote in message <i5leth$moe$1@fred.mathworks.com>...
> Hi, is it possible to specify some numbers written to file with dlmwrite to have different precisions? For example, imagine I wish to do the following:
>
> dlmwrite ('file',[vector1 vector2 vector3],'Delimiter',' ')
>
> where vector* are different column vectors. I would like to specify vector1 to have %.1f precision and the rest to be integers (or any combinations of precision). How could I achieve that?
> Thanks

I dont know about dlmwrite (but looking at the help it looks like the precision is for all elements.
However all is not lost as you could definately do it with fprintf.

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