Extracting values from vectors in an array and building a 3-dimensional array
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
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:
- dimension: 8760 to show values over time
- dimension: 8 to show values for 8 different locations
- 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!
Antworten (1)
William Smith
am 3 Apr. 2018
Bearbeitet: William Smith
am 3 Apr. 2018
reshape
might well be what you need, combined with
cell2mat
Diese Frage ist geschlossen.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!