필터 지우기
필터 지우기

Array Question time again

조회 수: 1 (최근 30일)
Max Müller
Max Müller 2014년 7월 31일
편집: Azzi Abdelmalek 2014년 7월 31일
Hey Guys, I have an 54x4 Array and every entry is another Array holding numbers. No i want to combine every line of the big array.
'J' 'J' 'J' 'J'
[1x41 double] [1x41 double] [1x41 double] [1x41 double]
[1x41 double] [1x41 double] [1x41 double] [1x41 double]
the goal is an an 1x161 Array named x. How can i combine this Arrays ?
  댓글 수: 1
Azzi Abdelmalek
Azzi Abdelmalek 2014년 7월 31일
You mean 1x64 array

댓글을 달려면 로그인하십시오.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 7월 31일
A={1:4 5:8 9:12;20:23 24:27 28:31}
B=num2cell(cell2mat(A),2)
  댓글 수: 2
Max Müller
Max Müller 2014년 7월 31일
maybe line was the wrong word.
Name: J' 'J' 'J' 'J'
x: [1x41 double] [1x41 double] [1x41 double] [1x41 double]
y: [1x41 double] [1x41 double] [1x41 double] [1x41 double]
So x and y have to be an 1x164 Array ( cause 4*41)|. I know i said 161 but....u know.... i am stupid :D
Azzi Abdelmalek
Azzi Abdelmalek 2014년 7월 31일
편집: Azzi Abdelmalek 2014년 7월 31일
A={'j' 'j' 'j';1:4 5:8 9:12;20:23 24:27 28:31}
B=A(2:end,:)
out=num2cell(cell2mat(B),2)

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Ahmet Cecen
Ahmet Cecen 2014년 7월 31일
Assuming this is a cell array, the naivest way to go is:
X=zeros(54,164);
for i=1:54
X(i,:)=[OldArray{i+1,1} OldArray{i+1,2} OldArray{i+1,3} OldArray{i+1,4}]; %i+1 because of the first row having j' j' j' j'.
end
Now ever row of X is an x vector as you requested.

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by