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!