看板 MATLAB 關於我們 聯絡資訊
程式碼如下: clc clear all x = 30 s = 1 app = 1 while(1); switch app case (1) xxx(s)= x+5 app = 2; pause(1); case (2) xxx(s)= x+10 app = 3; pause(1); case (3) xxx(s)= x+15 app=1; pause(1); end end 我想要讓xxx從case(1)時的答案延續到case(2)的再延續到case(3)一直迴圈下去... 最後要讓xxx=[35 45 60 65 75 90 .......] 我該如何做? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 120.126.8.123
tml:xxx=reshape(30*repmat(1:L,3,1)+repmat([5;15;30],1,L),1,[]) 12/06 08:11
tml:L是三倍陣列長度 12/06 08:11