How to read columns from matlab with different number of rows
조회 수: 5 (최근 30일)
이전 댓글 표시
I need to read all the numeric data from several columns of twelve excels. I'm referring specifically that I'd like to code a loop where I could save in a matrix all the data. For example, I create an array called "energia_activa" and there I have to save the column C of each excel. The problem is that each excel has a different number of rows so when I am reading them with a loop an error related to the dimmensions of the matrix in the left side and right side appears. How can I solve it?
On the other hand, one of the column of each excel I have to import has in several of the excels empty cells so when I am reading them an error appears as well. I'd be very grateful if you could help me.
Thank you in advance.
meses = ["enero 2019.xlsx","febrero 2019.xlsx", "marzo 2019.xlsx", "abril 2019.xlsx", "mayo 2019.xlsx", "junio 2019.xlsx", "julio 2019.xlsx", "agosto 2019.xlsx", "septiembre 2019.xlsx", "octubre 2019.xlsx", "noviembre 2019.xlsx", "diciembre 2019.xlsx"];
%ENERGÍA ACTIVA
dimensiones = zeros(1,12);
for i=1:12
dimensiones(1,i)=size(xlsread(meses(i),'C:C'),1);
end
energia_activa = zeros(max(dimensiones),12);
for i=1:dimensiones(i)
energia_activa(:,i)=xlsread(meses(i),'C:C')
end
댓글 수: 2
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!