[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to Store Data Detected by Octave
From: |
Ron . Simonson |
Subject: |
Re: How to Store Data Detected by Octave |
Date: |
Wed, 8 Mar 2017 17:25:32 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux i686 on x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 |
On 03/08/2017 03:29 PM, GuiCintraAlves wrote:
I'm using a barometer in an arduino where it gives me 4 variables.
I can read in the octave using the code:
clear;
pkg load instrument-control
s1 = serial("/dev/ttyACM0",9600 );
data = srl_read(s1,3000);
s1 = char(data)
...........................................
Temperatura = 26.90 *C
Pressao = 94474 Pa
Altitude = 585.79 metros
Altitude real = 600.34 metros
And... i need plot it. How i can store and plot??
--
View this message in context:
http://octave.1599824.n4.nabble.com/How-to-Store-Data-Detected-by-Octave-tp4682233.html
Sent from the Octave - General mailing list archive at Nabble.com.
_______________________________________________
Help-octave mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-octave
My preference is to separate data collection, and data plotting. I
would probably do something
like the following:
[t, p, a, ar] = sscanf(s1, "Temperatura = %f *C\nPressao = %f
Pa\nAltitude = %f metros\nAltitude
real = %f metros", "C");
outfile = "mydata.dat";
fpwrite = fopen(outfile, "w");
fprintf(fpwrite, "%#5.2f %#6d %#6.2f %#6.2f\n",
t, p, a, ar);
printf("%#5.2f %#6d %#6.2f %#6.2f\n",
t, p, a, ar);
fflush(fpwrite);
fclose(fpwrite);
and then, use gnuplot for plotting as shown in the attached plt file.
Hope this helps to get you started.
Ron.
datascan.plt
Description: Text document