Info
此问题已关闭。 请重新打开它进行编辑或回答。
Extracting values from vectors in an array and building a 3-dimensional array
1 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
回答(1 个)
William Smith
2018-4-3
编辑:William Smith
2018-4-3
reshape
might well be what you need, combined with
cell2mat
0 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!