Need Help With Complex Structures

2 views (last 30 days)
Stacey
Stacey on 29 Aug 2014
Edited: José-Luis on 29 Aug 2014
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 Comments
Image Analyst
Image Analyst on 29 Aug 2014
You could use celldisp() if you use my answer below (did you even see it?).
José-Luis
José-Luis on 29 Aug 2014
Edited: José-Luis on 29 Aug 2014
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).

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 29 Aug 2014
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

Categories

Find more on Variables in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!