在 Scilab 中使用 csvwrite 在换行符上打印

print on newline with csvwrite in Scilab

我有一个在 Scilab 中正确读取的 5x3 矩阵 .csv。我想创建一个 output.csv 显示第一列乘以二的乘积,并忽略其他列。

问题是,我希望输出显示为一列而不是一行,即我想要:

而不是 0 1 2 4 8

0 1个 2个 4个 8(我想这不会显示为一列,但我希望它是垂直的而不是水平的)

我想应用换行符命令“/n”来代替 csvWrite 函数中的最后一个参数“.”,但这不起作用。我得到:

write_csv:输入参数 #4 的错误值:'.'或','预期。 在由 :
调用的 exec 文件的第 13 行 执行('C:\Users\afullhar\Documents\Infiltration.sce', -1)

有没有办法使用“\n”或其他方法来创建我的新变量 timetimestwo 的列输出?

谢谢,我的代码如下:

//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',' ','.');

因为 time 是一个列向量并使用它来创建 timetimestwo,这也将是一个列向量。在您的 csvWrite 调用中,您使用 ' 转置矩阵,参见 quote character documentation。因此,简单地删除 ' 字符,将导致输出中出现非转置列向量。