How to import a specific column from a matrix that is looping through a directory?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
So I am trying to bring in a set of excel spreadsheets in a loop which I have successfully done so i have a directory, but now i want to read column 5 of each spreadsheet as it loops round so I finish with all 41 columns of data saved into a single matrix. This is my script so far:
gAfiles=dir('*'); %create directory
%%creating loop
for i=9:50
filename=gAfiles(i,1);
z_force=readmatrix(filename);
0 commentaires
Réponses (1)
Cris LaPierre
le 28 Déc 2020
Use indexing to tell MATLAB where to store the results. You can find an example in the for loop documentation.
When importing the data with readmatrix, specify the "Range" name vaue pair so it reads the 5th column. You can see syntax and examples under Name-Value pair arguents in the readmatrix documentation page.
0 commentaires
Voir également
Catégories
En savoir plus sur Spreadsheets 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!