将一些Matlabvariables保存在一个Excel文件中

我有几个Matlab输出variables,我想在一个Excel工作表中组合一个输出variables列。 如果我使用正常的'xlswrite'命令,我总是得到一个variables的值,连同variables名称作为文件名。 但是这不是我想要的。 我怎样才能做到这一点?

xlswrite的用法如下:

 xlswrite(filename,A,sheet,xlRange) 

其中文件名是文件名的string,A是数据,sheet是表号的整数,range是一个string范围,例如'C1:C2',其中C1和C2是两个相对的angular落,写。 例如,“D2:H4”表示两个angular部D2和H4之间的3乘5的矩形区域。

因此,对于同一个工作表的2列中的2个vector:

 filename = 'pathtofile.xls'; A = vector1; sheet=1; xlRange = 'A1:Ax'; %x is size of vector1, or use strcat('A1:A', num2str(len(A))); xlswrite(filename,A,sheet,xlRange); A = vector2; xlRange = 'B1:Bx'; %x is size of vector2, or use strcat('B1:B', num2str(len(A))); xlswrite(filename,A,sheet,xlRange); 

或者你可以把它们放在一个matrix中,写入'Axe:Bx'