Need Help With Complex Structures
이전 댓글 표시
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일
What do you mean by "displayed"?
Stacey
2014년 8월 29일
Image Analyst
2014년 8월 29일
You could use celldisp() if you use my answer below (did you even see it?).
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일
0 개 추천
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
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!