I have a 5x3 matrix .csv which is correctly read in Scilab. I want to create an output.csv showing the product of the first column multiplied by two, and ignore the other columns.
Trouble is, I want the output to be displayed as a column rather than a row, i.e. instead of 0 1 2 4 8, i want:
0 1 2 4 8 (I guess this doesn't show up as a column, but I want it to be vertical rather horizontal)
I would like to apply '/n', the newline command, in place of the last argument in the csvWrite function, '.', but this doesn't work. I get:
write_csv: Wrong value for input argument #4: '.' or ',' expected.
at line 13 of exec file called by :
exec('C:\Users\afullhar\Documents\Infiltration.sce', -1)
Is there a way to use '\n', or other ways to create column output of my new variable, timetimestwo?
Thanks, My code is below:
//import csv data
data_import = evstr(csvRead('input.csv', ','));
//extraction of columns and definition of variables
time=data_import(:,1)
rate=data_import(:,2)
cumulative=data_import(:,3)
//multiplication of time in hours by 2
timetimestwo=time*2
//export csv and print new variable
csvWrite(timetimestwo','output.csv',' ','.');
Because time
is a column vector and use that for the creation of timetimestwo
, this will also be a column vector. In your csvWrite
call you transpose the matrix with '
, see quote character documentation. So simply removing '
character, will result in a non-transposed and thus column vector in the output.