在 Scilab 中将多个列向量写入输出
Writing multiple column vectors to output in Scilab
我看到一些关于如何在 Matlab 中完成此操作的过于复杂的示例,但是 Scilab 呢?我成功地将单个列向量写入 output.csv,但如何将多个列向量写入同一个 output.csv。下面是打印单个列向量的代码,它显示了我希望也打印到 output.csv 的其他列向量(速率、累积)。如何做到这一点?
谢谢。
//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',' ');
*注意:我已经添加了一种将三列打印为单列的方法,但我仍然想打印为 3 列矩阵,我不确定为什么三列没有被拆分向上。我这样做了:
M = [timetimestwo; rate; cumulative]
for i = 1:3
csvWrite(M,'output.csv',',','.')
end
分号使它成为一个大列矩阵,你应该使用逗号。在下面的插图中,您可以看到这个概念,有点......
| | |[timetimestwo(1)],[rate(1)],[cumulative(1)]|
| | |[timetimestwo(2)],[rate(2)],[cumulative(2)]|
|[timetimestwo],[rate],[cumulative] | = |[timetimestwo(3)],[rate(3)],[cumulative(3)]|
| | |[timetimestwo(4)],[rate(4)],[cumulative(4)]|
| | |[timetimestwo(5)],[rate(5)],[cumulative(5)]|
您的问题的一个工作示例是:
//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
M=[timetimestwo,rate,cumulative]
//export csv and print new variable
csvWrite(M,'output.csv',' ');
我看到一些关于如何在 Matlab 中完成此操作的过于复杂的示例,但是 Scilab 呢?我成功地将单个列向量写入 output.csv,但如何将多个列向量写入同一个 output.csv。下面是打印单个列向量的代码,它显示了我希望也打印到 output.csv 的其他列向量(速率、累积)。如何做到这一点?
谢谢。
//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',' ');
*注意:我已经添加了一种将三列打印为单列的方法,但我仍然想打印为 3 列矩阵,我不确定为什么三列没有被拆分向上。我这样做了:
M = [timetimestwo; rate; cumulative]
for i = 1:3
csvWrite(M,'output.csv',',','.')
end
分号使它成为一个大列矩阵,你应该使用逗号。在下面的插图中,您可以看到这个概念,有点......
| | |[timetimestwo(1)],[rate(1)],[cumulative(1)]|
| | |[timetimestwo(2)],[rate(2)],[cumulative(2)]|
|[timetimestwo],[rate],[cumulative] | = |[timetimestwo(3)],[rate(3)],[cumulative(3)]|
| | |[timetimestwo(4)],[rate(4)],[cumulative(4)]|
| | |[timetimestwo(5)],[rate(5)],[cumulative(5)]|
您的问题的一个工作示例是:
//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
M=[timetimestwo,rate,cumulative]
//export csv and print new variable
csvWrite(M,'output.csv',' ');