[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Octave 4.0 Help requested and / or possible bug?
From: |
jmb |
Subject: |
Octave 4.0 Help requested and / or possible bug? |
Date: |
Thu, 6 Oct 2016 07:36:29 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 |
Hello,
I am trying to import some data which contains date & time strings for
the first time in octave 4.0.0 (Ubuntu12.04 64bit). I have tried
various methods but have not succeeded.
What I really want to do is plot segments of the 1757 data points, in
such as way that all plots begin at the same origin even though the time
stamped data runs into several days.
If I plot all 1757 points it may look something like this:
|
|
| ..... '''
| . . ' '
| . . ' '
| . ......' '''' (2 successive waves)
+--------------------------------------------
But I want to do this:
|
|
| .'''
| . '
| . '
| .' ''''... (i.e both waves starting at the same time)
+--------------------------------------------
(I am unable to place two symbols in the same location. Also if the
above representations look mangled please try using a fixed width font)
Could somebody take a look at the following code and provide some
assistance as to how I can accomplish what I am attempting to do with
Date_Time & Data{2}, please?
The 3 problems I am facing are:
a) Plotting just Num & Data{2} works
b) Converting Data{1} so that I can use it in a plot does not work. Is
this a bug as related to the URL at the end?
c) Attempts at plotting overlapping segments using Num & Data{2}, I do
not know how to do that.
Thank you.
Regards, JMB
#!/usr/bin/octave
# Testing... some code:
Data_Test = ['06/01/2015 3:07:12';'06/01/2015 3:07:23']
datevec(Data_Test,'mm/dd/yyyy HH:MM:SS') # Works
whos Data_Test
%Variables in the current scope:
%
% Attr Name Size Bytes Class
% ==== ==== ==== ===== =====
% Data_Test 2x18 36 char
%
%Total is 36 elements using 36 bytes
# This the format of the input file 'GTA.csv'
# with 7 comment lines and 2 lines of data
% Comment Line 1
% Comment Line 2
% Comment Line 3
% Comment Line 4
% Comment Line 5
% Comment Line 6
% Comment Line 7
%"10/03/2016 10:13:22" 94.7 372 0.00 120.2
0.0 0.01 12.5 0.1 12.6 0.01
25.6 91.4 90.5 90.3 90.0 90.6
%"10/03/2016 10:14:22" 94.7 372 0.00 120.1
0.0 0.00 12.5 0.0 12.7 0.01
25.6 91.8 90.1 89.8 90.3 90.5
% Multiple similar lines have been deleted for brevity
fileID = fopen('GTA.csv');
Data = textscan(fileID,'%s %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f
%f','Delimiter','\t','headerLines', 7);
fclose(fileID);
# whos Data
%Variables in the current scope:
%
% Attr Name Size Bytes Class
% ==== ==== ==== ===== =====
% Data 1x17 261793 cell
%
%Total is 17 elements using 261793 bytes
formatIn = 'mm/dd/yyyy HH:MM:SS';
# figure('Position',[0,0,1000,1000])
figure(1);
Num = 1:length(Data{2})
1 = plot(Num,Data{2},'b'); # Works
# h1 = plot(Date_Time,Data{2},'b');
datetick (formatIn);
# Date_Time = arrayfun(@datevec, [Data{1}; formatIn]) # error:
datevec: none of the standard formats match the DATE string
whos Data
%Variables in the current scope:
%
% Attr Name Size Bytes Class
% ==== ==== ==== ===== =====
% Data 1x17 261793 cell
%
%Total is 17 elements using 261793 bytes
whos Data{2}
%Variables in the current scope:
%
% Attr Name Size Bytes Class
% ==== ==== ==== ===== =====
% Data{2} 1757x1 14056 double
%
%Total is 1757 elements using 14056 bytes
# Ref:
https://stackoverflow.com/questions/31347193/trouble-with-datenum-in-octave
- Octave 4.0 Help requested and / or possible bug?,
jmb <=