Problem with Excel Open method

3 views (last 30 days)
Hi,
I am trying to use MATLAB to export some data. I implemented the following code snippet and plan to use the xlswrite1 function after (there is a lot of data to transfer):
function [] = write_out_dl21(fullfilename_in,dl21_param,data_in_display,data_in_summary_itvl,data_in_summary_total)
% Open file and call Excel methods
[pathstr, filename_in, file_ext] = fileparts(fullfilename_in)
% Excel methods DO not like spaces in the file names!
filename_in=strrep(filename_in,' ','_')
fullname_out = strcat(pathstr,'\',filename_in,'_OUT',file_ext);
The code above gives the error:
??? Invoke Error, Dispatch Exception:
Source: Microsoft Excel
Description: Excel cannot open the file 'inner_oslofjord_1_udp_ALL_EN_OUT.xlsx' because the file format or file
extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of
the file.
Help File: xlmain11.chm
Help Context ID: 0
Error in ==> write_out_dl21 at 38
ExcelWorkbook = Excel.workbooks.Open(fullname_out);
Do you have any hint? I tried shorter file names but it does not work...Using Windows 7 and MATLAB R2007b
Jose

Accepted Answer

Image Analyst
Image Analyst on 8 Apr 2015
Jose, your write_out_dl21() function does not do anything at all with Excel, xlswrite1(), or ActiveX. So we can't debug it.
Does "inner_oslofjord_1_udp_ALL_EN_OUT.xlsx" exist already, or not? If it exists, please attach it.
See my Excel ActiveX demo - maybe that will help you.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!