|
From: | Silvia Del-Din |
Subject: | Problem with parse function |
Date: | Thu, 12 Nov 2015 15:48:04 +0000 |
Dear All, I am using Octave trying to run a script written in Matlab. I am experiencing issues with the parse In the script I am calling a function enabling me to read specific .cwa files (accelerometry) – please see below. In Matlab I would normally use this code to get some information about the file: data = "" ‘info’,1);
In Octave it works if I remove the ‘’ data = "" info,1);
But unfortunately if I try to read the acceleration data of the file between 2 time frames, I get an error (error: 'startTime' undefined near line 1 column 28).
I have tried with and without ‘’, but it seems there is a problem that does not allow even the input to be parsed. data_ss=AX3_readFile(File, startTime, datenum(start), stopTime, datenum(stop)); Could you please give me any advice on this? Many thanks and Best Regards, function data = "" varargin)
%
% DATA = "" [OPTIONS])
%
% Reads in binary file as produced by AX3 accelerometer. Returns a
% struct filled with data from different modalities (ACC, LIGHT,
% TEMP). Relies on two external mex-functions (parseValueBlock.c,
% parseDate.c) that have to be compiled using the mex interface.
%
% Input arguments:
% FILENAME Path to AX3 sensor file
%
% OPTIONS:
%
% 'info' If set to 1, just reads information
% from file. Such as start time of
% logging, sensor id, etc. (see example
% below)
%
% 'validPackets' A Nx3 matrix containing pre-read valid
% packet locations, timestamps and
% timestamp offsets (produced by
% info-mode). Providing this will heavily
% improve runtime!
%
% 'startTime' Use this combined with 'stopTime' for
% sliced reading. I.e. read all samples
% from startTime to stopTime. Has to be
% given in Matlab-time format (see
% example below)
%
% 'stopTime' See above.
%
% 'modality' A three element vector [1, 1, 1] that
% indicates which sensor modalities to
% extract. Order is ACC, LIGHT, TEMP. To
% extract ACC and TEMP use [1, 0, 1].
%
% 'verbose' Print out debug messages about
% progress.
%
% 'useC' Heavily speed up parsing of samples and
% timestamps by relying on external
% c-code (parseValueBlock.c,
% parseDate.c). Requires compilation
% using mex-interface or pre-compiled
% binaries (.mexXXX files).
%
% EXAMPLES:
%
% Reading file information:
% >> fileinfo = AX3_readFile('foobar.cwa', 'info', 1, 'useC', 1)
% fileinfo =
% validPackets: [991997x3 double]
% start: [1x1 struct]
% stop: [1x1 struct]
% deviceId: 33
% sessionId: 0
% >> fileinfo.start
% ans =
% mtime: 7.3492e+05
% str: '17-Feb-2012 12:56:25'
%
% subsequent read of slice using pre-read packet info:
% >> data = "" ...
% 'validPackets', fileinfo.validPackets,
...
% 'startTime', datenum('19-Feb-2012 00:00:00'), ...
% 'stopTime', datenum('20-Feb-2012 00:00:00'));
%
% >> data =
""> % validPackets: [73059x3 double]
% ACC: [8766736x4 double]
% LIGHT: [73059x2 double]
% TEMP: [73059x2 double]
%
%
% v0.1
% Nils Hammerla, 2012 <address@hidden>
%
%
% Copyright (c) 2012, Newcastle University, UK.
% All rights reserved.
%
% Redistribution and use in source and binary forms,
with or without % modification, are permitted provided that the following
conditions are met: % 1. Redistributions of source code must retain the above
copyright notice, % this list of conditions and the following disclaimer.
% 2. Redistributions in binary form must reproduce the above copyright notice,
% this list of conditions and the following disclaimer
in the documentation % and/or other materials provided with the distribution.
%
% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
AND CONTRIBUTORS "AS IS" % AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE % IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE % ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
OR CONTRIBUTORS BE % LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR % CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF % SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS % INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN % CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) % ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE % POSSIBILITY OF SUCH DAMAGE.
%
% TODO:
% - Implement binary search through packet-space capable of
% handling broken packages (remove need for pre-reading
% packages)
% - Add proper use of checksums
% - Write object oriented version capable of handling different
% versions of format (past and future)
% parse arguments p = inputParser;
% define optional arguments with default values addOptional(p,'info',0,@isnumeric);
% just get file-info? addOptional(p,'validPackets',0,@isnumeric);
% pre-read packet info addOptional(p,'startTime',-1,@isnumeric);
% start time (matlab) addOptional(p,'stopTime',-1,@isnumeric);
% stop time (matlab) addOptional(p,'verbose',0,@isnumeric);
% print out progress addOptional(p,'useC',0,@isnumeric);
% use external c-code
% % for speed. addOptional(p,'modality',[1
1 1], @isnumeric); % specify modality
% [ACC LIGHT TEMP] parse(p,varargin{:});
% dispatch
if p.Results.info > 0, data = "" p.Results);
else data = "" p.Results);
end
end -- Silvia Del Din, PhD, MIET, MIEEE, ISPGR Research Associate Institute of Neuroscience (IoN) Newcastle University Institute for Ageing Clinical Ageing Research Unit Campus for Ageing and Vitality Newcastle upon Tyne NE4 5PL tel: +44 (0) 191 2081244 fax: +44 (0) 191 2081251 email:
address@hidden website: http://research.ncl.ac.uk/bam/ |
[Prev in Thread] | Current Thread | [Next in Thread] |