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

조회 수: 2 (최근 30일)
Ye
Ye 2015년 7월 21일
편집: Luuk van Oosten 2015년 7월 21일
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.

답변 (1개)

Luuk van Oosten
Luuk van Oosten 2015년 7월 21일
편집: Luuk van Oosten 2015년 7월 21일
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.

카테고리

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