Concatenation problem with a loop
    2 ビュー (過去 30 日間)
  
       古いコメントを表示
    
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
0 件のコメント
採用された回答
  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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
				Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!