필터 지우기
필터 지우기

Concatenation problem with a loop

조회 수: 2 (최근 30일)
Tristan
Tristan 2013년 9월 25일
How would you concatenate the two different results for D?
>> for X=[1.5 1.7],
D=(X*440)*(1:1:ceil(2000/(X*440)))
end
D =
660 1320 1980 2640
D =
748 1496 2244
to look like
D =
660 1320 1980 2640 748 1496 2244

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 9월 25일
편집: Azzi Abdelmalek 2013년 9월 25일
X=[1.5 1.7];
D=[];
for k=1:numel(X)
D=[D (X(k)*440)*(1:1:ceil(2000/(X(k)*440)))];
end
D
%or
X=[1.5 1.7];
D=cell2mat(arrayfun(@(y) (y*440)*(1:1:ceil(2000/(y*440))),X,'un',0))

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by