필터 지우기
필터 지우기

Reading '*.xlsm' files

조회 수: 27 (최근 30일)
Marcus Vinicius
Marcus Vinicius 2023년 5월 9일
답변: Sulaymon Eshkabilov 2023년 5월 9일
All of a sudden MATALAB stopped reading .xlsm files \
d = dir('*.xlsm'); %Read xlsm files in current folderPCA_Data_Set
for i = 1:size(d,1)
nom=d(i).name; %find names
nam=nom(1:7); %reduce name (for example from first to 5th character)
rename = strcat(nam,'.xlsm'); %rewrite the name
movefile(d(i).name, rename); %replacement names
end
%% Extracted sensor data
d = dir('*.xlsm');
meanX=[];names=[]; %Create empty arrays for future storage
for i = 1:size(d,1)
nom = d(i).name; %Read name of xlsm file
po=find(nom=='.'); %Search de name
nam=nom(1:po-1); %Extracted the name
opts = detectImportOptions(nom);%Read option for 'nom' matrix
T1 = readtable(nom,opts); %Read xlsm file
Tx = readtable(d(2).name,opts);
[sensors_readings] = extract_into_one_v1_UIUC7(T1);
sensor_all{i} = sensors_readings;
I get this error message...
Error using detectImportOptions (line 266)
Unable to open file 'C:\Users\Marcus Ferreira\Desktop\Ru Enose Data\Data13\Air0000.xlsm'
as a workbook. Check that the file exists, read access is
available, and the file is a valid spreadsheet file.
Error in Enose_Exctraction_code_UIUC (line 46)
opts = detectImportOptions(nom);%Read option for 'nom' matrix
  댓글 수: 1
dpb
dpb 2023년 5월 9일
What with the renaming and all, not terribly surprised may have messed something up; nothing here anybody can do without even a single file to look at...but, my experience with such a case is that the file type doesn't match the extension given to it -- Excel won't open a file that is actually a .xlsx or .xls if it is externally renamed to something different. That would be my first guess...

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

답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023년 5월 9일
There might be another case that your intended data file(s) is (are) open and cursor is inside the file.

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by