2014-02-28 1 views
0

그래서이 코드가 있습니다.xlswrite를 사용하여 오류가 발생했습니다.

전달 =

ForwardDifferentiation(a, eq, deltaX); 
    Backward = BackwardDifferentiation(a, eq, deltaX); 
    Central = CentralDifferentiation(a, eq, deltaX); 
    SecDeriv = second(a, eq, deltaX); 
    ThirdDeriv = third(a, eq, deltaX); 
    FourthDeriv = fourth(a, eq, deltaX); 

    fprintf('y'' using Forward Difference @x=%g is: %.5f', a, Forward); 
    fprintf('\ny'' using Backward Difference @x=%g is: %.5f', a, Backward); 
    fprintf('\ny'' using Central Difference @x=%g is: %.5f', a, Central); 
    fprintf('\ny" using Second Derivative @x=%g is: %.5f', a, SecDeriv); 
    fprintf('\ny"'' using Third Derivative @x=%g is: %.5f', a, ThirdDeriv); 
    fprintf('\ny"" using Fourth Derivative @x=%g is: %.5f', a, FourthDeriv); 

    filename = 'NumericalDifferentiation.xlsx'; 
    A = {'y''(Forward Diff)', 'y''(Backward Diff)', 'y''(Central Diff)', ... 
    'y"', 'y"''', 'y""'; Forward, Backward, Central, SecDeriv, ... 
    ThirdDeriv, FourthDeriv}; 
    xlswrite(filename,A) % Writing an xls file 

그러나 오류가 항상 xlswrite에 대해 발생합니다

오류 xlswrite를 사용하여 (라인 220) 파일 C : \ 프로그램 파일 \ MATLAB \ R2013a \ 빈 \ MP2a \ NumericalDifferentiation .xlsx는 쓰기 가능하지 않습니다. 다른 프로세스에 의해 잠길 수 있습니다.

및 NumDif에서

오류 (라인 66) xlswrite (파일 이름, A) %는

나는이 문제를 어떻게 해결할 수있는 XLS 파일 작성?

답변

1

.xls 파일이 어딘가에서 열려 있으면 파일을 쓸 수 없습니다. 모든 프로그램에서 .xls 파일을 닫은 다음 코드를 실행 해보십시오.

+0

.xls 파일을 열 수 없습니다. –