help in coding for station data

1 次查看(过去 30 天)
yea = 0;
for ye = 2009:2017
yea = yea+1;
data{yea} = load(['D:\DataStation\hr', num2str(ye),'\mat\station.mat']);
data{yea} = data{1,yea}.station_1(:,:);
end
i write above programme and get matrix 8760x9 double this for station 1
i have 30 station and i want matrix 8760x270 double
i am writing code data{yea} = [data{1,yea}.station_1(:,:); data{1,yea}.station_2(:,:);] i think this not correct method
please help
  1 个评论
the cyclist
the cyclist 2021-8-12
编辑:the cyclist 2021-8-12
It might be helpful for you to upload two or three of the station.mat files here, so people can test code. (You could just trim them to a few rows, if you don't want to upload all the data.)
Is there are specific reason you are using cell arrays to store the data? If it is all numeric data, that might not be the best approach.
Also, have you considered making the data 8760x9x30, where the stations are the 3rd dimension?
Finally, I would be remiss if I did not mention that dynamic naming of variables (e.g. station_1, station_2, etc) is generally a terrible coding practice. See, e.g. this explanation of why. It would be good if we can figure out a way to not do that.

请先登录,再进行评论。

采纳的回答

Image Analyst
Image Analyst 2021-8-12

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by