필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

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

조회 수: 1 (최근 30일)
Oddi
Oddi 2018년 3월 31일
마감: MATLAB Answer Bot 2021년 8월 20일
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!

답변 (1개)

William Smith
William Smith 2018년 4월 3일
편집: William Smith 2018년 4월 3일
reshape
might well be what you need, combined with
cell2mat

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by