How to import a specific column from a matrix that is looping through a directory?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Cris LaPierre
el 28 de Dic. de 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 comentarios
Ver también
Categorías
Más información sobre Spreadsheets en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!