Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xlsfile is broken in Matlab 2022a #6

Open
davidakelley opened this issue Sep 15, 2022 · 0 comments
Open

xlsfile is broken in Matlab 2022a #6

davidakelley opened this issue Sep 15, 2022 · 0 comments

Comments

@davidakelley
Copy link
Owner

xlsfile fails in Matlab 2022a with the following error:

Error using cbd.xlsfile
Error:File: xlsfile.m Line: 92 Column: 51
Identifier 'workbook' is not a function or a shared variable. To share 'workbook' with a nested function,
initialize it in the current scope. For more information, see Sharing Variables Between Parent and Nested
Functions.

I'm not sure what the long-term fix is since the COM interface seems to have changed somewhat, but a temporary solution appears to be to replace lines 78-101 of xlsfile with the following:

if ~newWb
    obj.xlApp.DisplayAlerts = 0;
    obj.xlApp.workbooks.Open(obj.file, 0, readOnly);
    obj.wkBook = obj.xlApp.ActiveWorkbook;
end

wbProps = get(obj.wkBook);
if wbProps.ReadOnly && ~readOnly
    warning('xlsfile:readOnly', 'Excel file opened read only.');
end

I'll try to circle back on this soon, but this should let you at least use xlsfile in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant