Opening the excel file from matlab, and problem with directory path

2 vues (au cours des 30 derniers jours)
Ye
Ye le 21 Juil 2015
function startServ1
exl = actxserver('excel.application');
% Load data from an excel file
% Get Workbook interface and open file
exlWkbk = exl.Workbooks;
exlWkbk.Open(['C:\Users\ye\Desktop\plotting_begunon_20July2015\june2015.xslx']);
% Get interface for Sheet1 and read data into range object
The above is my cod and I am getting error as the following:
Error using Interface.Microsoft_Excel_12.0_Object_Library.Workbooks/Open Error using Interface.Microsoft_Excel_12.0_Object_Library.Workbooks/Open Invoke Error, Dispatch Exception: Source: Microsoft Office Excel Description: 'C:\Users\shankyaw\Desktop\MATLAB\helpC:\Users\shankyaw\Desktop\work_plotting_begunon_20July2015\020111020.xslx' could not be found. Check the spelling of the file name, and verify that the file location is correct.
I repeatedly made sure that the direction is correct. How to get away with this problem as I am totally lost. Your help will be appreciated very much. Thanks.

Réponses (1)

Luuk van Oosten
Luuk van Oosten le 21 Juil 2015
Modifié(e) : Luuk van Oosten le 21 Juil 2015
I believe you got the extension wrong (xslx should be xlsx).
try:
exlWkbk.Open(['C:\Users\ye\Desktop\plotting_begunon_20July2015\june2015.xlsx'])
and why do you try to open the file: june2015.xlsx
While your error gives you the statement that it cannot open: 020111020.xslx
This does not make sense.

Community Treasure Hunt

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

Start Hunting!

Translated by