Effacer les filtres
Effacer les filtres

Reading '*.xlsm' files

27 vues (au cours des 30 derniers jours)
Marcus Vinicius
Marcus Vinicius le 9 Mai 2023
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 commentaire
dpb
dpb le 9 Mai 2023
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...

Connectez-vous pour commenter.

Réponses (1)

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

Catégories

En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by