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:
how to write numerical values evaluated to a file

Subject: how to write numerical values evaluated to a file

From: robert clive

Date: 5 Dec, 2010 12:29:04

Message: 1 of 5

hi
 i need to know how we can write numerical values to the file,
which can be used by other programs in visual basic

Subject: how to write numerical values evaluated to a file

From: Paulo Silva

Date: 5 Dec, 2010 13:48:03

Message: 2 of 5

"robert clive" <robert.clive48@yahoo.com> wrote in message <idg0ig$m22$1@fred.mathworks.com>...
> hi
> i need to know how we can write numerical values to the file,
> which can be used by other programs in visual basic

http://www.mathworks.com/help/techdoc/import_export/f5-15544.html

Subject: how to write numerical values evaluated to a file

From: robert clive

Date: 5 Dec, 2010 17:52:04

Message: 3 of 5

"Paulo Silva" <paulojmdsilva@gmail.com> wrote in message <idg56j$h40$1@fred.mathworks.com>...
> "robert clive" <robert.clive48@yahoo.com> wrote in message <idg0ig$m22$1@fred.mathworks.com>...
> > hi
> > i need to know how we can write numerical values to the file,
> > which can be used by other programs in visual basic
>
> http://www.mathworks.com/help/techdoc/import_export/f5-15544.html

i appending values to the file exp.txt as below

fid = fopen('exp.txt', 'a');
fprintf(fid, '%6.2f\n',metric);
fclose(fid);

i need to get back those values in file asl elements to an array which can be passed to

Y = pdist(A)

below is the way i tried to read to array in the matlab only but its not reading correct
 fid=fopen('exp.txt');
  A = fread(fid,inf);
  display(A);
  fclose(fid);

for dispaly(A) its giving value

    32
    32
    48
    46
    57
    49
    10
but it contain 0.91
value in text file

Subject: how to write numerical values evaluated to a file

From: robert clive

Date: 5 Dec, 2010 18:26:04

Message: 4 of 5

"robert clive" <robert.clive48@yahoo.com> wrote in message <idgjg4$2uq$1@fred.mathworks.com>...
> "Paulo Silva" <paulojmdsilva@gmail.com> wrote in message <idg56j$h40$1@fred.mathworks.com>...
> > "robert clive" <robert.clive48@yahoo.com> wrote in message <idg0ig$m22$1@fred.mathworks.com>...
> > > hi
> > > i need to know how we can write numerical values to the file,
> > > which can be used by other programs in visual basic
> >
> > http://www.mathworks.com/help/techdoc/import_export/f5-15544.html
>
> i appending values to the file exp.txt as below
>
> fid = fopen('exp.txt', 'a');
> fprintf(fid, '%6.2f\n',metric);
> fclose(fid);
>
> i need to get back those values in file asl elements to an array which can be passed to
>
> Y = pdist(A)
>
> below is the way i tried to read to array in the matlab only but its not reading correct
> fid=fopen('exp.txt');
> A = fread(fid,inf);
> display(A);
> fclose(fid);
>
> for dispaly(A) its giving value
>
> 32
> 32
> 48
> 46
> 57
> 49
> 10
> but it contain 0.91
> value in text file



thanks that link contain info about numerical data extration

finally i got correct output in matlab..

Subject: how to write numerical values evaluated to a file

From: Steven_Lord

Date: 5 Dec, 2010 22:47:32

Message: 5 of 5



"robert clive" <robert.clive48@yahoo.com> wrote in message
news:idgjg4$2uq$1@fred.mathworks.com...
> "Paulo Silva" <paulojmdsilva@gmail.com> wrote in message
> <idg56j$h40$1@fred.mathworks.com>...
>> "robert clive" <robert.clive48@yahoo.com> wrote in message
>> <idg0ig$m22$1@fred.mathworks.com>...
>> > hi
>> > i need to know how we can write numerical values to the file,
>> > which can be used by other programs in visual basic
>>
>> http://www.mathworks.com/help/techdoc/import_export/f5-15544.html
>
> i appending values to the file exp.txt as below
>
> fid = fopen('exp.txt', 'a');
> fprintf(fid, '%6.2f\n',metric);
> fclose(fid);
>
> i need to get back those values in file asl elements to an array which can
> be passed to
> Y = pdist(A)

If you need to store data to a file in such a way that it'll be easy to read
back into MATLAB, use SAVE to write the file to disk and LOAD to read the
file back into MATLAB.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlab.wikia.com/wiki/FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

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