Clear Filters
Clear Filters

help in coding for station data

1 view (last 30 days)
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 Comment
the cyclist
the cyclist on 12 Aug 2021
Edited: the cyclist on 12 Aug 2021
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.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 12 Aug 2021

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!