无法写入Excel(Matlab)

时间:2014-02-18 16:19:37

标签: excel matlab

我收到以下错误:“未定义变量”结果“或类”results.xlsx“当我尝试将输出从我的代码写入Excel电子表格时。我似乎无法理解为什么会出现这种情况。

function [final_matrix] = MCsolutionupdated()

no_iterations = input('No. of iterations?:');

thresh_strain = zeros(1,no_iterations*16);

casechoice =input('Enter 1 for 1st Layup and 2 for 2nd layup:');

 J = Nielsennewupdated(casechoice, no_iterations);
 thresh_strain = J;


roundedValues = round(thresh_strain/.0001)*0.0001;
myUniqueValues = unique(roundedValues);
i = numel(myUniqueValues);
nelements  = hist(thresh_strain(:),myUniqueValues); 

for i=1:i
    percent(i)  = (nelements(1,i)/numel(thresh_strain))*100;
end

final_matrix = [myUniqueValues' percent'];

xlswrite(results.xlsx, final_matrix); % Problem

1 个答案:

答案 0 :(得分:2)

您需要将文件名放在引号('')中:

xlswrite('results.xlsx', final_matrix);