Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

Extracting values from vectors in an array and building a 3-dimensional array

1 view (last 30 days)
Hi everyone, I have the following issue. I have in total 8 arrays of the size 365x1000. The problem is, that all entries are vectors. I had to do that to sample 1000 scenarios of a year long hourly production in which days are treated as units. Is there a possibility to extract the values of the vectors and allign them along the first dimension, making it 8760 long and 1000 broad?
The next issue is, if there is a way to build an array out of all 8 arrays with 3 dimensions, but making the scenarios the third dimension? So at the end, the array should be of the form and content:
  1. dimension: 8760 to show values over time
  2. dimension: 8 to show values for 8 different locations
  3. dimension: 1000 for the different scenarios
The code I used to produce the existing array is:
V = rand (35040,1);
v={};
for i=1:1460
Tag=zeros(1,24);
if i==1
Tag=V(i:i*24);
else
Tag=V((((i-1)*24)+1):(i*24));
end
v{i}=Tag;
end
for j = 1:1000
for k=1:365
r = randi (1460, 1);
M = v{r};
X{k,j}=M;
end
end
Thank you in advance!

Answers (1)

William Smith
William Smith on 3 Apr 2018
Edited: William Smith on 3 Apr 2018
reshape
might well be what you need, combined with
cell2mat

This question is closed.

Community Treasure Hunt

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

Start Hunting!