import a certain text file .txt from a specific folder
22 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Alberto Acri
le 23 Nov 2022
Réponse apportée : Mathieu NOE
le 23 Nov 2022
I want to import a certain text file .txt from a specific folder.
In case the .txt file is saved in the current folder I open it this way:
import_txt = importdata('name of file.txt');
In my case I proceeded in this way but it is not the correct solution:
folder = 'C:\Users\Alberto\....'; % folder where the .txt file is located.
import_txt = importdata('name of file.txt', folder);
0 commentaires
Réponse acceptée
Jean-Baptiste Lanfrey
le 23 Nov 2022
Something like this should work:
folder = 'C:\Users\Alberto\....'; % folder where the .txt file is located.
filename = fullfile(folder, 'name of file.txt');
import_txt = importdata(filename);
0 commentaires
Plus de réponses (1)
Mathieu NOE
le 23 Nov 2022
hello again
for numerical arrays use readmatrix instead of importdata
folder = 'C:\Users\Alberto\....'; % folder where the .txt file is located.
import_txt = importdata(fullfile(folder, 'file.txt')); % or readmatrix
0 commentaires
Voir également
Catégories
En savoir plus sur Data Import and Analysis dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!