使用csvwrite将矩阵写入文件时出现问题

时间:2017-04-02 17:19:01

标签: matlab

我正在尝试使用此函数csvwrite('myMatrix.dat',L);(其中L是方阵)将矩阵输出到 CSV文件(逗号分隔)我收到此错误:

>> csvwrite('myMatrix.dat',L);
Error using sprintf
Function is not defined for sparse inputs.

Error in dlmwrite (line 169)
        str = sprintf(format,m(i,:));

Error in csvwrite (line 42)
dlmwrite(filename, m, ',', r, c);

请问,这有什么问题?

1 个答案:

答案 0 :(得分:1)

您看到的错误是输入(参数)的问题。它告诉你文件名必须是“字符向量”。

关于“matlab角色向量”的快速谷歌给了我这个: http://mathworks.com/help/matlab/matlab_prog/creating-character-arrays.html#briuv_1-1

google on“matlab csvwrite”给我这个: http://mathworks.com/help/matlab/ref/csvwrite.html?requestedDomain=www.mathworks.com

字面意思是google中出现的第一批结果......

至少尝试比较你提供的例子。

相关问题