Error using readtable after R2023a update
Afficher commentaires plus anciens
Hello,
I'm having an issue with a code that was written for me, and the person who worked on it is no longer available and I am not very proficient with matlab. It was working fine until I updated to R2023a, so I am wondering if that may be part of it (I think it was 2022 prior). The code goes:
for fileno=1:ROI_number
ROI_file_name = append(('ROI'),num2str(fileno),'.csv');
ROI = readtable(ROI_file_name); ROI = ROI{:,:};
.....
end
The error I'm getting is
Error using readtable
Unable to find or open 'ROI2.csv'. Check the path and filename or file permissions.
Error in (my file name) (line #)
ROI = readtable(ROI_file_name); ROI = ROI{:;:};
So it seems to me the script is expecting more files, but the problem is that my datasets could contain any number of ROI1, ROI2, ROI3, ROI4, so on. For this dataset, I only have ROI1, so it tries to search for an ROI2. If I create an ROI2, it looks for an ROI3. How can I stop it searching for files that do not exist or expecting more files?
Thank you!
Réponses (1)
Cris LaPierre
le 25 Avr 2023
Modifié(e) : Cris LaPierre
le 25 Avr 2023
0 votes
The error has nothing to do with your version of MATLAB. You wrote your code expecting it to load multiple files, and now the number of files to load is different.
It is looking for every file incrementally from ROI1.csv to ROI<ROI_number>.csv (note that your readtable command is inside a for loop).
Adjust the value of ROI_number or remove the for loop to load a single file.
1 commentaire
Margret
le 25 Avr 2023
Catégories
En savoir plus sur Image Arithmetic dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!