Here is a simple example of how to use the open source engineering tool SciLab to plot accelerometer data from an Android device. The data is logged with the application Acceleration Log and is stored as a semicolon separated csv file, which can be downloaded here.
The scilab script file (.sce) can be downloaded here.
[sourcecode]
mode(0)
clear
//Description: Simple plotter example of acceleration data in csv-format from Android application Acceleration log
//Authour: Key – www.realglitch.com
//Data file location
filedir = "C:\MyProject\";
filename = "demoplot_acceleration_log_data.csv";
//Define colors and descriptions for 3 columns of data
colors = {‘r-‘,’g-‘,’b-‘};
descriptions = {"Ax","Ay","Az"};
//Get data from csv-file with European formating (; separator)
data_values = csvRead(filedir + filename,";");
//Remove column headlines
data_values = data_values(2:$,:);
//Create figure and loop through all columns and plot all data agains first column.
f = scf();
for i = 1:size(data_values,2)-1,
//Plot columns, with different colors
plot(data_values(:,1),data_values(:,i+1),colors(i));
end
//Set other figure graphics
title("Acceleration log plot")
xlabel("Time [ms]");
ylabel("Acceleration [m/s2]");
h = legend(descriptions);
[/sourcecode]
Since the release of Scilab 5.4.0 the new GUI is much more user friendly, and the program is yet another step closer to a valid replacement to Matlab when scripting.
Hello,
Just to inform you that you should replace read_csv/eval by csvRead with ‘double’ argument, on big CSV it’s a better way.
I just write a blog post on that pitfall 🙂
Thanks, you are right! The csvRead is far more elegant than going via the eval, so I have edited the code. Dosn’t seem to need the double argument, so I left that out.
Thanks, Helped me a lot.
hi, I have a signal from acceleration and I want to find heel strike and Toe off.how I use ‘[HS,TO]=SK_gedAlgo(accx,accy,accz,Fs,winsize factor,implement_type)’.
Thanks from response.