Need Help With Complex Structures
3 次查看(过去 30 天)
显示 更早的评论
Hi, I am currently working on a project where I am forecasting PV output.
I need to create a structure in Matlab that shows several predicted values for PV output at one point in time.
This is the data my structure must contain: Current Time=[1 2 3 4.....]
Now at Current Time=1, I need an another array that looks like this: Forecast Time=[2,3,4.....] Forecasted PV Output=[400,420,415......]
Then at Current Time=2,3,4..... I need to show the same data because for every point in time, there are several forecasted values.
I'm not sure how to make a structure that shows all of my data the way I need it to be displayed. If someone could please help me figure this out, I would really appreciate it!!!
4 个评论
José-Luis
2014-8-29
编辑:José-Luis
2014-8-29
It might be exactly what you just said, but it was not entirely clear to me, I'm sorry. Hence my request for clarification.
There is a difference between displayed (where? on screen, in a file, in the command window) and stored (e.g. as a cell array like Image Analyst suggests).
回答(1 个)
Image Analyst
2014-8-29
Sounds like you need a cell array rather than an array of structures. With cell arrays, each cell can contain variables of variable length. So I'd have a N by 2 cell array, where the cells in column 1 contain the ForecastTime arrays, which could all have different lengths, and the second column would contain the ForecastedPVOutput arrays, again which could have different lengths in each row. The row corresponds to the "current time". See the discussion of cell arrays in the FAQ: http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!