problem in evalin with matlab app designer.

조회 수: 1 (최근 30일)
Oddineus
Oddineus 2019년 4월 19일
댓글: Alexander Kornegay 2020년 9월 14일
Hello everyone.
im running an .mlapp which will create Excel file and save data on it, im using xlswrite1 to do it.
so the problem is i get this message every time i save the data to the Excel file.
'Error using evalin
Undefined function or variable 'Excel'.
Error in xlswrite1 (line 2)
Excel=evalin('base','Excel');'
why? and how to solve it.
My Code:
% Saving the data:
app.NEW3='Results';
SubjectNumberH,=1000;
Excel = actxserver ('Excel.Application');
folder = pwd;
baseFileName =app.NEW3;
fullFileName = fullfile(folder, baseFileName);
ExcelWorkbook = Excel.workbooks.Add;
ExcelWorkbook.SaveAs(fullFileName,1);
ExcelWorkbook.Close(false);
invoke(Excel.Workbooks,'Open',fullFileName);
xlswrite1(fullFileName,SubjectNumberH,);
invoke(Excel.ActiveWorkbook,'Save');
Excel.Quit
Excel.delete
clear Excel
  댓글 수: 2
Oddineus
Oddineus 2019년 4월 19일
i got the answer.
for people with the same issue try to oppen the function file xlswrite1 and then replace the first line
Excel = evalin('base','Excel');
with
try
Excel = evalin('caller','Excel');
catch err
Excel = evalin('base','Excel');
end
thank you.
Alexander Kornegay
Alexander Kornegay 2020년 9월 14일
Thanks for sharing. This saved me a lot of time!

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by