summaryrefslogtreecommitdiff
path: root/Tutorial1_Basic/Scilab_code/Tutotial1_filehandling.sce
blob: a2e46967a1219e245381a76f1b4a8b3517bac889 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//This function is to import data from a csv file and store it in a variable
//Using the data mean and standard deviation of the data is computed
clear
clc

exec mymean.sci;
exec mystdev.sci;

//Import data from csv file
Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial1_Basic/Data/Tut1_data1.csv');
x = Data(:,1);
y = Data(:,2);


//Compute mean of the imported data
mean_of_x = mymean(x);
//Compute standard deviation of the imported data
stdev_of_x= mystdev(x,mean_of_x);

//Data to be exported (It can be a scalar, vector or matrix)
data_to_write = [mean_of_x stdev_of_x];
//Export data to a csv file
csvWrite(data_to_write,'/home/chayan/Documents/scilab-tutorials/Tutorial1_Basic/Data/Tut1_data3.csv')