在matlab6.1版本下手动加入xlswrite函数时,往excel写时提示错误
数据文件test.xls在附件里,源程序为% solve the equation
function Calculate
A = [1 1 1;620 182 400;1 2.65 2.2];
b = [1;0;0];
X = zeros(939,3);%赋值
temp = xlsread('test.xls');
for i = 1: 939
b(2,1) = temp(i,1);
b(3,1) = temp(i,2);
B = A\b;
%fprintf(1,'第 %d 行 M,N对应的X1,X2,X3结果:\n',i);
for j = 1:3
X(i,j) = B(j,1);
%fprintf(1,'%5.4f\n',X(j,1));
end
end
X
%fid = fopen('result.xls', 'w+');
%fid = fopen('result.txt', 'w+');
%fwrite(fid,X);
%fclose(fid);
xlswrite('result.xls', X);
错误信息:
??? Error: File: D:\matlab6.1\toolbox\matlab\iofun\xlswrite.m Line: 88 Column: 16
Expected a variable, function, or constant, found "&".
Error in ==> D:\matlab6.1\work\Calculate.m
On line 22 ==> xlswrite('result.xls', X);
自己已经在D:\matlab6.1\toolbox\matlab\iofun与D:\matlab6.1\toolbox\matlab\iofun\ja
下加入xlswrite函数,应该不会提示错误,难道是底版本的matlab不能加入xlswrite函数?
烦请各位能解释一下?