what does x= [ones(1,2) 2 ones(1,1) 2 ones(1,2) 1] do?
    2 次查看(过去 30 天)
  
       显示 更早的评论
    
采纳的回答
  KSSV
      
      
 2019-5-8
        It depends on the requirement of what array you want. If you see that line generates: 
[1     1     2     1     2     1     1     1]
The array has 2 in 3rd, 4th position. So 2 is used. The same can also be generated using: 
 X = ones(1,8) ;
 X([3 5]) = 2
更多回答(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!